Patchwork D7860: graftcopies: remove `skip` and `repo` arguments

login
register
mail settings
Submitter phabricator
Date Jan. 16, 2020, 4:32 p.m.
Message ID <e7fa7863921248e4ac3be71b7d4d10a5@localhost.localdomain>
Download mbox | patch
Permalink /patch/44445/
State Not Applicable
Headers show

Comments

phabricator - Jan. 16, 2020, 4:32 p.m.
Closed by commit rHG833210fbd900: graftcopies: remove `skip` and `repo` arguments (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7860?vs=19251&id=19371

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7860/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7860

AFFECTED FILES
  hgext/fix.py
  hgext/rebase.py
  mercurial/copies.py
  mercurial/merge.py
  relnotes/next

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -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).
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2635,7 +2635,7 @@ 
         repo.setparents(pctx.node(), pother)
         repo.dirstate.write(repo.currenttransaction())
         # fix up dirstate for copies and renames
-        copies.graftcopies(repo, wctx, ctx, base)
+        copies.graftcopies(wctx, ctx, base)
     return stats
 
 
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -856,30 +856,11 @@ 
         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:
-            continue
         wctx[dst].markcopied(src)
 
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1497,16 +1497,13 @@ 
         labels=[b'dest', b'source'],
         wc=wctx,
     )
-    destctx = repo[dest]
     if collapse:
-        copies.graftcopies(repo, wctx, ctx, destctx)
+        copies.graftcopies(wctx, ctx, repo[dest])
     else:
         # 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
 
 
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -734,8 +734,7 @@ 
     extra[b'fix_source'] = ctx.hex()
 
     wctx = context.overlayworkingctx(repo)
-    newp1ctx = repo[newp1node]
-    wctx.setbase(newp1ctx)
+    wctx.setbase(repo[newp1node])
     merge.update(
         repo,
         ctx.rev(),
@@ -745,7 +744,7 @@ 
         mergeancestor=False,
         wc=wctx,
     )
-    copies.graftcopies(repo, wctx, ctx, ctx.p1(), skip=newp1ctx)
+    copies.graftcopies(wctx, ctx, ctx.p1())
 
     for path in filedata.keys():
         fctx = ctx[path]