Patchwork D753: dirstate: move nonnormalentries to dirstatemap

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2017, 6:43 p.m.
Message ID <a4290e661a0d220ccd43e425709a731a@localhost.localdomain>
Download mbox | patch
Permalink /patch/24211/
State Not Applicable
Headers show

Comments

phabricator - Sept. 29, 2017, 6:43 p.m.
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&id=2156

REVISION DETAIL
  https://phab.mercurial-scm.org/D753

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: durham, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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
+