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.
--- 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