[PATCH 2 of 4 more-matchers] merge: restate calculateupdates in terms of a matcher
Augie Fackler
raf at durin42.com
Mon Dec 14 21:17:18 CST 2015
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1450143461 18000
# Mon Dec 14 20:37:41 2015 -0500
# Node ID 39b26fa17e85304fe227f06a7a7cc3cffa02ad19
# Parent 3c54f3c2fcbc57639d3501f4e592045d1b702cf6
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.
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -253,7 +253,7 @@ def perfmergecalculate(ui, repo, rev, **
# 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 @@ def perflrucache(ui, size=4, gets=10000,
timer, fm = gettimer(ui, opts)
timer(fn, title=title)
fm.end()
-
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -192,7 +192,6 @@ class mercurial_sink(converter_sink):
self.repo, p1ctx, p2ctx, anc,
True, # branchmerge
True, # force
- False, # partial
False, # acceptremote
False, # followcopies
)
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -458,11 +458,11 @@ def overridecheckunknownfile(origfn, rep
# 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
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -841,9 +841,13 @@ def _resolvetrivial(repo, wctx, mctx, an
# 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 @@ def update(repo, node, branchmerge, forc
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():
More information about the Mercurial-devel
mailing list