changeset 26650:6ff5534c8afc

merge.mergestate: add support for persisting driver-resolved files A driver-resolved file is a file that's handled specially by the driver. A common use case for this state would be autogenerated files, the generation of which should happen only after all source conflicts are resolved. This is done with an uppercase letter because older versions of Mercurial will not know how to treat such files at all.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 28 Sep 2015 18:34:06 -0700
parents f618b6aa8cdd
children d58f2f0e2b19
files mercurial/merge.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Sep 30 21:42:52 2015 -0700
+++ b/mercurial/merge.py	Mon Sep 28 18:34:06 2015 -0700
@@ -61,6 +61,8 @@
     L: the node of the "local" part of the merge (hexified version)
     O: the node of the "other" part of the merge (hexified version)
     F: a file to be merged entry
+    D: a file that the external merge driver will merge internally
+       (experimental)
     m: the external merge driver defined for this merge plus its run state
        (experimental)
 
@@ -125,7 +127,7 @@
                         _("merge driver changed since merge started"),
                         hint=_("revert merge driver change or abort merge"))
                 self._mdstate = mdstate
-            elif rtype == 'F':
+            elif rtype in 'FD':
                 bits = record.split('\0')
                 self._state[bits[0]] = bits[1:]
             elif not rtype.islower():
@@ -254,7 +256,10 @@
                 records.append(('m', '\0'.join([
                     self.mergedriver, self._mdstate])))
             for d, v in self._state.iteritems():
-                records.append(('F', '\0'.join([d] + v)))
+                if v[0] == 'd':
+                    records.append(('D', '\0'.join([d] + v)))
+                else:
+                    records.append(('F', '\0'.join([d] + v)))
             self._writerecords(records)
             self._dirty = False