Commit 833210fbd90 by Martin von Zweigbergk

graftcopies: remove `skip` and `repo` arguments

The `skip` argument was added in 2ba6c9b4e0eb (rebase: fix bug that
caused transitive copy records to disappear (issue4192), 2014-06-07)
in order to fix I
ran tests at that commit without the `skiprev` argument and the only
difference I noticed was that `test-rebase-collapse.t` failed
differently, in the call that is now on line 501. Without the
`skiprev` argument, that call would end up creating another commit
because it tried to record an invalid copy. With the previous patch in
this series, such invalid copies are no longer recorded, so it seems
we don't need the `skip` argument anymore.

I also removed the `repo` argument since that also becomes unused with
the removal of the `skip` argument.

Differential Revision:
parent 3df0bd706c4
......@@ -734,8 +734,7 @@ def replacerev(ui, repo, ctx, filedata, replacements):
extra[b'fix_source'] = ctx.hex()
wctx = context.overlayworkingctx(repo)
newp1ctx = repo[newp1node]
......@@ -745,7 +744,7 @@ def replacerev(ui, repo, ctx, filedata, replacements):
copies.graftcopies(repo, wctx, ctx, ctx.p1(), skip=newp1ctx)
copies.graftcopies(wctx, ctx, ctx.p1())
for path in filedata.keys():
fctx = ctx[path]
......@@ -1497,16 +1497,13 @@ def rebasenode(repo, rev, p1, base, collapse, dest, wctx):
labels=[b'dest', b'source'],
destctx = repo[dest]
if collapse:
copies.graftcopies(repo, wctx, ctx, destctx)
copies.graftcopies(wctx, ctx, repo[dest])
# If we're not using --collapse, we need to
# duplicate copies between the revision we're
# rebasing and its first parent, but *not*
# duplicate any copies that have already been
# performed in the destination.
copies.graftcopies(repo, wctx, ctx, ctx.p1(), skip=destctx)
# rebasing and its first parent.
copies.graftcopies(wctx, ctx, ctx.p1())
return stats
......@@ -856,30 +856,11 @@ def _related(f1, f2):
return False
def graftcopies(repo, wctx, ctx, base, skip=None):
"""reproduce copies between base and ctx in the wctx
If skip is specified, it's a revision that should be used to
filter copy records. Any copies that occur between base and
skip will not be duplicated, even if they appear in the set of
copies between base and ctx.
exclude = {}
ctraceconfig = repo.ui.config(b'experimental', b'copytrace')
bctrace = stringutil.parsebool(ctraceconfig)
if skip is not None and (
ctraceconfig == b'heuristics' or bctrace or bctrace is None
# copytrace='off' skips this line, but not the entire function because
# the line below is O(size of the repo) during a rebase, while the rest
# of the function is much faster (and is required for carrying copy
# metadata across the rebase anyway).
exclude = pathcopies(base, skip)
def graftcopies(wctx, ctx, base):
"""reproduce copies between base and ctx in the wctx"""
new_copies = pathcopies(base, ctx)
_filter(wctx.p1(), wctx, new_copies)
for dst, src in pycompat.iteritems(new_copies):
if dst in exclude:
......@@ -2635,7 +2635,7 @@ def graft(
repo.setparents(pctx.node(), pother)
# fix up dirstate for copies and renames
copies.graftcopies(repo, wctx, ctx, base)
copies.graftcopies(wctx, ctx, base)
return stats
......@@ -31,4 +31,5 @@
* `copies.duplicatecopies()` was renamed to
`copies.graftcopies()`. Its arguments changed from revision numbers
to context objects.
to context objects. It also lost its `repo` and `skip` arguments
(they should no longer be needed).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment