# HG changeset patch # User Martin von Zweigbergk # Date 2014-11-19 19:48:30 # Node ID b85c548ab14df22a26041a395e89c434e49a3976 # Parent 18ab5e5955dfc8a01506d49fe7c4b488c30680f4 merge: introduce 'c' action like 'g', but with additional safety _checkunknownfile() reads the filelog of the remote side's file. For narrow clones, the filelog will not exist for all files and we need a way to avoid reading them. While it would be easier for the narrow extension to just override _checkunknownfile() and make it ignore files outside the narrow clone, it seems cleaner to have manifestmerge() not care about filelogs (considering its name). In order to move the calls to _checkunknownfile() out, we need to be able to tell in which cases we should check for unknown files. Let's start by introducing a new action distinct from 'g' for this purpose. Specifically, the new action will be just like 'g' except that it will check that for conflicting unknown files first. For now, just add the new action type and convert it to 'g'. diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -488,10 +488,10 @@ def manifestmerge(repo, wctx, p2, pa, br # following table: # # force branchmerge different | action - # n * n | get + # n * n | create # n * y | abort - # y n * | get - # y y n | get + # y n * | create + # y y n | create # y y y | merge # # Checking whether the files are different is expensive, so we @@ -501,9 +501,9 @@ def manifestmerge(repo, wctx, p2, pa, br if different: aborts.append((f, "ud")) else: - actions[f] = ('g', (fl2,), "remote created") + actions[f] = ('c', (fl2,), "remote created") elif not branchmerge: - actions[f] = ('g', (fl2,), "remote created") + actions[f] = ('c', (fl2,), "remote created") else: different = _checkunknownfile(repo, wctx, p2, f) if different: @@ -517,7 +517,7 @@ def manifestmerge(repo, wctx, p2, pa, br aborts.append((f, 'ud')) else: if acceptremote: - actions[f] = ('g', (fl2,), "remote recreating") + actions[f] = ('c', (fl2,), "remote recreating") else: actions[f] = ('dc', (fl2,), "prompt deleted/changed") @@ -529,6 +529,10 @@ def manifestmerge(repo, wctx, p2, pa, br raise util.Abort(_("untracked files in working directory differ " "from files in requested revision")) + for f, (m, args, msg) in actions.iteritems(): + if m == 'c': + actions[f] = ('g', args, msg) + return actions, diverge, renamedelete def _resolvetrivial(repo, wctx, mctx, ancestor, actions):