[PATCH 6 of 8] merge: create 'cm' action for 'get or merge' case
Martin von Zweigbergk
martinvonz at google.com
Mon Dec 22 18:33:40 CST 2014
# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1418690719 28800
# Mon Dec 15 16:45:19 2014 -0800
# Node ID a194174c25fd329be8a74f5b10586187c414f85d
# Parent d32c1035354d1317dced8a8263673ad590aaa6aa
merge: create 'cm' action for 'get or merge' case
We still have one case of a call to _checkunknownfile() in
manifestmerge(): when force=True and branchmerge=True and the remote
side has a file that the local side doesn't. This combination of
arguments is used by 'hg merge --force', but also by rebase and
unshelve. In this scenario, we try to create the file from the
contents from the remote, but if there is already a local untracked
file in place, we merge it instead.
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -501,12 +501,8 @@
elif not branchmerge:
actions[f] = ('c', (fl2,), "remote created")
else:
- different = _checkunknownfile(repo, wctx, p2, f)
- if different:
- actions[f] = ('m', (f, f, None, False, pa.node()),
- "remote differs from untracked local")
- else:
- actions[f] = ('g', (fl2,), "remote created")
+ actions[f] = ('cm', (fl2, pa.node()),
+ "remote created, get or merge")
elif n2 != ma[f]:
if acceptremote:
actions[f] = ('c', (fl2,), "remote recreating")
@@ -532,6 +528,14 @@
for f, (m, args, msg) in actions.iteritems():
if m == 'c':
actions[f] = ('g', args, msg)
+ elif m == 'cm':
+ fl2, anc = args
+ different = _checkunknownfile(repo, wctx, p2, f)
+ if different:
+ actions[f] = ('m', (f, f, None, False, anc),
+ "remote differs from untracked local")
+ else:
+ actions[f] = ('g', (fl2,), "remote created")
return actions, diverge, renamedelete
More information about the Mercurial-devel
mailing list