D753: dirstate: move nonnormalentries to dirstatemap
This revision was automatically updated to reflect the committed changes. Closed by commit rHG362ed91ca00c: dirstate: move nonnormalentries to dirstatemap (authored by durham, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D753?vs=1948=2156 REVISION DETAIL https://phab.mercurial-scm.org/D753 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -54,20 +54,6 @@ os.close(tmpfd) vfs.unlink(tmpname) -def nonnormalentries(dmap): -'''Compute the nonnormal dirstate entries from the dmap''' -try: -return parsers.nonnormalotherparententries(dmap._map) -except AttributeError: -nonnorm = set() -otherparent = set() -for fname, e in dmap.iteritems(): -if e[0] != 'n' or e[3] == -1: -nonnorm.add(fname) -if e[0] == 'n' and e[2] == -2: -otherparent.add(fname) -return nonnorm, otherparent - class dirstate(object): def __init__(self, opener, ui, root, validate, sparsematchfn): @@ -162,13 +148,13 @@ @propertycache def _nonnormalset(self): -nonnorm, otherparents = nonnormalentries(self._map) +nonnorm, otherparents = self._map.nonnormalentries() self._otherparentset = otherparents return nonnorm @propertycache def _otherparentset(self): -nonnorm, otherparents = nonnormalentries(self._map) +nonnorm, otherparents = self._map.nonnormalentries() self._nonnormalset = nonnorm return otherparents @@ -843,7 +829,7 @@ st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl, now)) -self._nonnormalset, self._otherparentset = nonnormalentries(self._map) +self._nonnormalset, self._otherparentset = self._map.nonnormalentries() st.close() self._lastnormaltime = 0 self._dirty = self._dirtypl = False @@ -1369,3 +1355,18 @@ def keys(self): return self._map.keys() + +def nonnormalentries(self): +'''Compute the nonnormal dirstate entries from the dmap''' +try: +return parsers.nonnormalotherparententries(self._map) +except AttributeError: +nonnorm = set() +otherparent = set() +for fname, e in self._map.iteritems(): +if e[0] != 'n' or e[3] == -1: +nonnorm.add(fname) +if e[0] == 'n' and e[2] == -2: +otherparent.add(fname) +return nonnorm, otherparent + To: durham, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D753: dirstate: move nonnormalentries to dirstatemap
durham created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As part of moving dirstate storage to its own class, let's move the nonnormalentries logic onto the dirstatemap class. This will let extensions replace the nonnormalentries logic with a persisted cache. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D753 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -54,20 +54,6 @@ os.close(tmpfd) vfs.unlink(tmpname) -def nonnormalentries(dmap): -'''Compute the nonnormal dirstate entries from the dmap''' -try: -return parsers.nonnormalotherparententries(dmap._map) -except AttributeError: -nonnorm = set() -otherparent = set() -for fname, e in dmap.iteritems(): -if e[0] != 'n' or e[3] == -1: -nonnorm.add(fname) -if e[0] == 'n' and e[2] == -2: -otherparent.add(fname) -return nonnorm, otherparent - class dirstate(object): def __init__(self, opener, ui, root, validate, sparsematchfn): @@ -162,13 +148,13 @@ @propertycache def _nonnormalset(self): -nonnorm, otherparents = nonnormalentries(self._map) +nonnorm, otherparents = self._map.nonnormalentries() self._otherparentset = otherparents return nonnorm @propertycache def _otherparentset(self): -nonnorm, otherparents = nonnormalentries(self._map) +nonnorm, otherparents = self._map.nonnormalentries() self._nonnormalset = nonnorm return otherparents @@ -843,7 +829,7 @@ st.write(parsers.pack_dirstate(self._map._map, self._copymap, self._pl, now)) -self._nonnormalset, self._otherparentset = nonnormalentries(self._map) +self._nonnormalset, self._otherparentset = self._map.nonnormalentries() st.close() self._lastnormaltime = 0 self._dirty = self._dirtypl = False @@ -1369,3 +1355,18 @@ def keys(self): return self._map.keys() + +def nonnormalentries(self): +'''Compute the nonnormal dirstate entries from the dmap''' +try: +return parsers.nonnormalotherparententries(self._map) +except AttributeError: +nonnorm = set() +otherparent = set() +for fname, e in self._map.iteritems(): +if e[0] != 'n' or e[3] == -1: +nonnorm.add(fname) +if e[0] == 'n' and e[2] == -2: +otherparent.add(fname) +return nonnorm, otherparent + To: durham, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel