diff mercurial/context.py @ 34787:754b5117622f

context: add workingfilectx.markcopied With in-memory merge, copy information needs to be stored in-memory, not in the dirstate. To make this transition easy, move the existing dirstate-based approach to workingfilectx; that way, other implementations can choose to store it somewhere else. Differential Revision: https://phab.mercurial-scm.org/D1106
author Phil Cohen <phillco@fb.com>
date Sun, 15 Oct 2017 20:36:29 -0700
parents 0c812885586b
children 07bbb208a924
line wrap: on
line diff
--- a/mercurial/context.py	Sun Oct 15 20:36:29 2017 -0700
+++ b/mercurial/context.py	Sun Oct 15 20:36:29 2017 -0700
@@ -1935,6 +1935,11 @@
         self._repo.wwrite(self._path, data, flags,
                           backgroundclose=backgroundclose)
 
+    def markcopied(self, src):
+        """marks this file a copy of `src`"""
+        if self._repo.dirstate[self._path] in "nma":
+            self._repo.dirstate.copy(src, self._path)
+
     def clearunknown(self):
         """Removes conflicting items in the working directory so that
         ``write()`` can be called successfully.