mergestate: add methods to queue files to remove, add or get
authorSiddharth Agarwal <sid0@fb.com>
Sun, 22 Nov 2015 21:59:52 -0800
changeset 27090 ef6f98473a48
parent 27089 dbb30bc16fc2
child 27091 2ce00de5cc0e
mergestate: add methods to queue files to remove, add or get These are meant for use by custom merge drivers that might want to modify the dirstate. Dirstate internal consistency rules require that all removes happen before any adds -- this means that custom merge drivers shouldn't be modifying the dirstate directly.
mercurial/merge.py
--- a/mercurial/merge.py	Sun Nov 15 21:27:22 2015 -0800
+++ b/mercurial/merge.py	Sun Nov 22 21:59:52 2015 -0800
@@ -522,6 +522,24 @@
         branchmerge = self._repo.dirstate.p2() != nullid
         recordupdates(self._repo, self.actions(), branchmerge)
 
+    def queueremove(self, f):
+        """queues a file to be removed from the dirstate
+
+        Meant for use by custom merge drivers."""
+        self._results[f] = 0, 'r'
+
+    def queueadd(self, f):
+        """queues a file to be added to the dirstate
+
+        Meant for use by custom merge drivers."""
+        self._results[f] = 0, 'a'
+
+    def queueget(self, f):
+        """queues a file to be marked modified in the dirstate
+
+        Meant for use by custom merge drivers."""
+        self._results[f] = 0, 'g'
+
 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
     if f2 is None:
         f2 = f