D980: dirstate: move identity to dirstatemap

durham (Durham Goode) phabricator at mercurial-scm.org
Sat Oct 14 00:55:07 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc6ef9a2498a5: dirstate: move identity to dirstatemap (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D980?vs=2510&id=2709

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

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
@@ -133,11 +133,6 @@
         return self._map
 
     @propertycache
-    def _identity(self):
-        self._read()
-        return self._identity
-
-    @propertycache
     def _filefoldmap(self):
         return self._map.filefoldmap()
 
@@ -375,9 +370,6 @@
             raise
 
     def _read(self):
-        # ignore HG_PENDING because identity is used only for writing
-        self._identity = util.filestat.frompath(
-            self._opener.join(self._filename))
         self._map = dirstatemap(self._ui, self._opener, self._root)
         self._map.read()
 
@@ -388,8 +380,7 @@
         rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
         check whether the dirstate has changed before rereading it.'''
 
-        for a in ("_map", "_identity",
-                  "_filefoldmap", "_dirfoldmap", "_branch",
+        for a in ("_map", "_filefoldmap", "_dirfoldmap", "_branch",
                   "_dirs", "_ignore"):
             if a in self.__dict__:
                 delattr(self, a)
@@ -652,7 +643,7 @@
         If identity of previous dirstate is equal to this, writing
         changes based on the former dirstate out can keep consistency.
         '''
-        return self._identity
+        return self._map.identity
 
     def write(self, tr):
         if not self._dirty:
@@ -1342,6 +1333,10 @@
         self._dirtyparents = True
 
     def read(self):
+        # ignore HG_PENDING because identity is used only for writing
+        self.identity = util.filestat.frompath(
+            self._opener.join(self._filename))
+
         try:
             fp = self._opendirstatefile()
             try:
@@ -1404,3 +1399,8 @@
         self.nonnormalset = nonnorm
         return otherparents
 
+    @propertycache
+    def identity(self):
+        self.read()
+        return self.identity
+



To: durham, #hg-reviewers, quark, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list