[PATCH 4 of 5 mergedriver] mergestate: add methods to queue files to remove, add or get

Siddharth Agarwal sid0 at fb.com
Mon Nov 23 00:00:50 CST 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1448258392 28800
#      Sun Nov 22 21:59:52 2015 -0800
# Node ID 39b2bc59e3b1d7ef13c996b30fafa293c6116854
# Parent  bc37d2bf7a29597601a08bbb37139a1b80550c39
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 39b2bc59e3b1
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.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -522,6 +522,24 @@ class mergestate(object):
         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


More information about the Mercurial-devel mailing list