# HG changeset patch # User Martin von Zweigbergk # Date 1418690719 28800 # Node ID 9d56be47b5d6a07d3c63f1f7d35621c0fa0eeb75 # Parent 0297d84693506cb849b380dfe630c4a1a1d817fb 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 -r 0297d8469350 -r 9d56be47b5d6 mercurial/merge.py --- a/mercurial/merge.py Fri Dec 12 23:18:36 2014 -0800 +++ b/mercurial/merge.py Mon Dec 15 16:45:19 2014 -0800 @@ -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