# HG changeset patch # User Alexis S. L. Carvalho # Date 1184885005 10800 # Node ID a11921d24ec4f6cdc1720d4d37f90c6f9a74ad2f # Parent 667290b6c95ecdfa19022ab2b7de792c4a59016f add dirstate._dirtypl variable Theoretically, it's possible to forget modified dirstate parents by doing: dirstate.invalidate() dirstate.setparents(p1, p2) dirstate._map The final access to _map should call _read(), which will unconditionally overwrite dirstate._pl. This doesn't actually happen right now because invalidate accidentally ends up rebuilding dirstate._map. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -21,6 +21,7 @@ class dirstate(object): self._opener = opener self._root = root self._dirty = 0 + self._dirtypl = 0 self._ui = ui def __getattr__(self, name): @@ -114,6 +115,7 @@ class dirstate(object): def setparents(self, p1, p2=nullid): self.markdirty() + self._dirtypl = 1 self._pl = p1, p2 def setbranch(self, branch): @@ -126,7 +128,8 @@ class dirstate(object): def _read(self): self._map = {} self._copymap = {} - self._pl = [nullid, nullid] + if not self._dirtypl: + self._pl = [nullid, nullid] try: st = self._opener("dirstate").read() except IOError, err: @@ -135,7 +138,8 @@ class dirstate(object): if not st: return - self._pl = [st[:20], st[20: 40]] + if not self._dirtypl: + self._pl = [st[:20], st[20: 40]] # deref fields so they will be local in loop dmap = self._map @@ -262,6 +266,7 @@ class dirstate(object): st.write(cs.getvalue()) st.rename() self._dirty = 0 + self._dirtypl = 0 def filterfiles(self, files): ret = {}