[PATCH 7 of 7 mergedriver] mergestate: allow storing and retrieving change/delete conflicts
Siddharth Agarwal
sid0 at fb.com
Mon Nov 16 23:46:11 UTC 2015
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1447485379 28800
# Fri Nov 13 23:16:19 2015 -0800
# Node ID c5c0131799323cf9d85c520264e05cbfa228b1bf
# Parent c56137c086886035f7798a28d901bd794def8680
mergestate: allow storing and retrieving change/delete conflicts
We introduce a new record type, 'C', to indicate change/delete conflicts. This
is a separate record type because older versions of Mercurial will not be able
to handle these conflicts.
We aren't actually storing any change/delete conflicts yet -- that will come in
future patches.
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -16,6 +16,7 @@ from .i18n import _
from .node import (
bin,
hex,
+ nullhex,
nullid,
nullrev,
)
@@ -61,6 +62,7 @@ class mergestate(object):
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
+ C: a change/delete or delete/change conflict
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
@@ -125,7 +127,7 @@ class mergestate(object):
self._readmergedriver = bits[0]
self._mdstate = mdstate
- elif rtype in 'FD':
+ elif rtype in 'FDC':
bits = record.split('\0')
self._state[bits[0]] = bits[1:]
elif not rtype.islower():
@@ -273,6 +275,10 @@ class mergestate(object):
records.append(('m', '\0'.join([
self.mergedriver, self._mdstate])))
for d, v in self._state.iteritems():
+ # v[1] == local ('cd'), v[6] == other ('dc') -- not supported by
+ # older versions of Mercurial
+ if v[1] == nullhex or v[6] == nullhex:
+ records.append(('C', '\0'.join([d] + v)))
if v[0] == 'd':
records.append(('D', '\0'.join([d] + v)))
else:
More information about the Mercurial-devel
mailing list