merge: restate calculateupdates in terms of a matcher
Once we get a matcher down into manifestmerge, we can make narrowhg
work more easily and potentially let manifest.match().diff() do less
work in manifestmerge.
--- a/contrib/perf.py Mon Dec 14 18:54:03 2015 -0500
+++ b/contrib/perf.py Mon Dec 14 20:37:41 2015 -0500
@@ -253,7 +253,7 @@
# acceptremote is True because we don't want prompts in the middle of
# our benchmark
merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False,
- False, acceptremote=True, followcopies=True)
+ acceptremote=True, followcopies=True)
timer(d)
fm.end()
@@ -679,4 +679,3 @@
timer, fm = gettimer(ui, opts)
timer(fn, title=title)
fm.end()
-
--- a/hgext/convert/hg.py Mon Dec 14 18:54:03 2015 -0500
+++ b/hgext/convert/hg.py Mon Dec 14 20:37:41 2015 -0500
@@ -192,7 +192,6 @@
self.repo, p1ctx, p2ctx, anc,
True, # branchmerge
True, # force
- False, # partial
False, # acceptremote
False, # followcopies
)
--- a/hgext/largefiles/overrides.py Mon Dec 14 18:54:03 2015 -0500
+++ b/hgext/largefiles/overrides.py Mon Dec 14 20:37:41 2015 -0500
@@ -458,11 +458,11 @@
# writing the files into the working copy and lfcommands.updatelfiles
# will update the largefiles.
def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
- partial, acceptremote, followcopies):
+ acceptremote, followcopies, matcher=None):
overwrite = force and not branchmerge
actions, diverge, renamedelete = origfn(
- repo, p1, p2, pas, branchmerge, force, partial, acceptremote,
- followcopies)
+ repo, p1, p2, pas, branchmerge, force, acceptremote,
+ followcopies, matcher=matcher)
if overwrite:
return actions, diverge, renamedelete
--- a/mercurial/merge.py Mon Dec 14 18:54:03 2015 -0500
+++ b/mercurial/merge.py Mon Dec 14 20:37:41 2015 -0500
@@ -841,9 +841,13 @@
# remote did change but ended up with same content
del actions[f] # don't get = keep local deleted
-def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
- acceptremote, followcopies):
+def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
+ acceptremote, followcopies, matcher=None):
"Calculate the actions needed to merge mctx into wctx using ancestors"
+ if matcher is None or matcher.always():
+ partial = False
+ else:
+ partial = matcher.matchfn
if len(ancestors) == 1: # default
actions, diverge, renamedelete = manifestmerge(
@@ -1414,13 +1418,9 @@
followcopies = True
### calculate phase
- if matcher is None or matcher.always():
- partial = False
- else:
- partial = matcher.matchfn
actionbyfile, diverge, renamedelete = calculateupdates(
- repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
- followcopies)
+ repo, wc, p2, pas, branchmerge, force, mergeancestor,
+ followcopies, matcher=matcher)
# Convert to dictionary-of-lists format
actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split())
for f, (m, args, msg) in actionbyfile.iteritems():