Patchwork D758: dirstate: move parent reading to the dirstatemap class

login
register
mail settings
Submitter phabricator
Date Sept. 26, 2017, 10:59 a.m.
Message ID <4c1b8ac1364287fa27b82137ff5076e7@localhost.localdomain>
Download mbox | patch
Permalink /patch/24156/
State Not Applicable
Headers show

Comments

phabricator - Sept. 26, 2017, 10:59 a.m.
durham updated this revision to Diff 2082.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D758?vs=1953&id=2082

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -186,19 +186,7 @@ 
 
     @propertycache
     def _pl(self):
-        try:
-            fp = self._map._opendirstatefile()
-            st = fp.read(40)
-            fp.close()
-            l = len(st)
-            if l == 40:
-                return st[:20], st[20:40]
-            elif l > 0 and l < 40:
-                raise error.Abort(_('working directory state appears damaged!'))
-        except IOError as err:
-            if err.errno != errno.ENOENT:
-                raise
-        return [nullid, nullid]
+        return self._map.parents()
 
     @propertycache
     def _dirs(self):
@@ -1381,3 +1369,17 @@ 
         self._pendingmode = mode
         return fp
 
+    def parents(self):
+        try:
+            fp = self._opendirstatefile()
+            st = fp.read(40)
+            fp.close()
+            l = len(st)
+            if l == 40:
+                return st[:20], st[20:40]
+            elif l > 0 and l < 40:
+                raise error.Abort(_('working directory state appears damaged!'))
+        except IOError as err:
+            if err.errno != errno.ENOENT:
+                raise
+        return [nullid, nullid]