changeset 27090:ef6f98473a48

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.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 22 Nov 2015 21:59:52 -0800
parents dbb30bc16fc2
children 2ce00de5cc0e
files mercurial/merge.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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