Patchwork D1235: overlayworkingctx: track copy information in the context

login
register
mail settings
Submitter phabricator
Date Dec. 7, 2017, 9:45 p.m.
Message ID <f772673788c886961383cb238e201829@localhost.localdomain>
Download mbox | patch
Permalink /patch/26035/
State Not Applicable
Headers show

Comments

phabricator - Dec. 7, 2017, 9:45 p.m.
phillco updated this revision to Diff 4200.

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




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

Patch

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