merge.calculateupdate() takes a lot of parameters and I get confused
all the time which is which.
See also b14fdf1fb615 (update: clarify update() call sites by
specifying argument names, 2017-02-09).
durin42 | |
pulkit |
hg-reviewers |
merge.calculateupdate() takes a lot of parameters and I get confused
all the time which is which.
See also b14fdf1fb615 (update: clarify update() call sites by
specifying argument names, 2017-02-09).
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
def perfmergecalculate(ui, repo, **opts): | def perfmergecalculate(ui, repo, **opts): | ||||
opts = _byteskwargs(opts) | opts = _byteskwargs(opts) | ||||
timer, fm = gettimer(ui, opts) | timer, fm = gettimer(ui, opts) | ||||
wctx, rctx, ancestor = _getmergerevs(repo, opts) | wctx, rctx, ancestor = _getmergerevs(repo, opts) | ||||
def d(): | def d(): | ||||
# acceptremote is True because we don't want prompts in the middle of | # acceptremote is True because we don't want prompts in the middle of | ||||
# our benchmark | # our benchmark | ||||
merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False, | merge.calculateupdates(repo, wctx, rctx, [ancestor], branchmerge=False, | ||||
acceptremote=True, followcopies=True) | force=False, acceptremote=True, | ||||
followcopies=True) | |||||
timer(d) | timer(d) | ||||
fm.end() | fm.end() | ||||
@command(b'perfmergecopies', | @command(b'perfmergecopies', | ||||
[ | [ | ||||
(b'r', b'rev', b'.', b'rev to merge against'), | (b'r', b'rev', b'.', b'rev to merge against'), | ||||
(b'', b'from', b'', b'rev to merge from'), | (b'', b'from', b'', b'rev to merge from'), | ||||
(b'', b'base', b'', b'the revision to use as base'), | (b'', b'base', b'', b'the revision to use as base'), |
This prevents us from losing files that only exist in the target p2 and | This prevents us from losing files that only exist in the target p2 and | ||||
that don't come from the source repo (like if you're merging multiple | that don't come from the source repo (like if you're merging multiple | ||||
repositories together). | repositories together). | ||||
""" | """ | ||||
anc = [p1ctx.ancestor(p2ctx)] | anc = [p1ctx.ancestor(p2ctx)] | ||||
# Calculate what files are coming from p2 | # Calculate what files are coming from p2 | ||||
actions, diverge, rename = mergemod.calculateupdates( | actions, diverge, rename = mergemod.calculateupdates( | ||||
self.repo, p1ctx, p2ctx, anc, | self.repo, p1ctx, p2ctx, anc, branchmerge=True, | ||||
True, # branchmerge | force=True, acceptremote=False, followcopies=False) | ||||
True, # force | |||||
False, # acceptremote | |||||
False, # followcopies | |||||
) | |||||
for file, (action, info, msg) in actions.iteritems(): | for file, (action, info, msg) in actions.iteritems(): | ||||
if source.targetfilebelongstosource(file): | if source.targetfilebelongstosource(file): | ||||
# If the file belongs to the source repo, ignore the p2 | # If the file belongs to the source repo, ignore the p2 | ||||
# since it will be covered by the existing fileset. | # since it will be covered by the existing fileset. | ||||
continue | continue | ||||
# If the file requires actual merging, abort. We don't have enough | # If the file requires actual merging, abort. We don't have enough |
# collision after we've started histedit and backing out gets ugly | # collision after we've started histedit and backing out gets ugly | ||||
# for everyone, especially the user. | # for everyone, especially the user. | ||||
for c in [ctxs[0].p1()] + ctxs: | for c in [ctxs[0].p1()] + ctxs: | ||||
try: | try: | ||||
mergemod.calculateupdates( | mergemod.calculateupdates( | ||||
repo, wctx, c, ancs, | repo, wctx, c, ancs, | ||||
# These parameters were determined by print-debugging | # These parameters were determined by print-debugging | ||||
# what happens later on inside histedit. | # what happens later on inside histedit. | ||||
False, # branchmerge | branchmerge=False, force=False, acceptremote=False, | ||||
False, # force | followcopies=False) | ||||
False, # acceptremote | |||||
False, # followcopies | |||||
) | |||||
except error.Abort: | except error.Abort: | ||||
raise error.Abort( | raise error.Abort( | ||||
_("untracked files in working directory conflict with files in %s") % ( | _("untracked files in working directory conflict with files in %s") % ( | ||||
c)) | c)) | ||||
if not rules: | if not rules: | ||||
comment = geteditcomment(ui, node.short(root), node.short(topmost)) | comment = geteditcomment(ui, node.short(root), node.short(topmost)) | ||||
actions = [pick(state, r) for r in revs] | actions = [pick(state, r) for r in revs] |