D1235: overlayworkingctx: track copy information in the context

phillco (Phil Cohen) phabricator at mercurial-scm.org
Thu Dec 7 17:16:02 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8b3a636bb341: overlayworkingctx: track copy information in the context (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1235?vs=4200&id=4223

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1985,6 +1985,7 @@
         'date': date?
         'data': str?
         'flags': str?
+        'copied': str? (path or None)
     }
     If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
     is `False`, the file was deleted.
@@ -2022,6 +2023,18 @@
         else:
             return self._wrappedctx[path].date()
 
+    def markcopied(self, path, origin):
+        if self.isdirty(path):
+            self._cache[path]['copied'] = origin
+        else:
+            raise error.ProgrammingError('markcopied() called on clean context')
+
+    def copydata(self, path):
+        if self.isdirty(path):
+            return self._cache[path]['copied']
+        else:
+            raise error.ProgrammingError('copydata() called on clean context')
+
     def flags(self, path):
         if self.isdirty(path):
             if self._cache[path]['exists']:
@@ -2086,6 +2099,7 @@
             'data': data,
             'date': date,
             'flags': flags,
+            'copied': None,
         }
 
     def filectx(self, path, filelog=None):
@@ -2122,16 +2136,17 @@
         return self._parent.exists(self._path)
 
     def renamed(self):
-        # Copies are currently tracked in the dirstate as before. Straight copy
-        # from workingfilectx.
-        rp = self._repo.dirstate.copied(self._path)
-        if not rp:
+        path = self._parent.copydata(self._path)
+        if not path:
             return None
-        return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
+        return path, self._changectx._parents[0]._manifest.get(path, nullid)
 
     def size(self):
         return self._parent.size(self._path)
 
+    def markcopied(self, origin):
+        self._parent.markcopied(self._path, origin)
+
     def audit(self):
         pass
 



To: phillco, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list