Patchwork D9073: rebase: when collapsing, p1 == dest, so use the former only

login
register
mail settings
Submitter phabricator
Date Sept. 23, 2020, 4:37 p.m.
Message ID <differential-rev-PHID-DREV-7umnunyeks2awhth7r3d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47259/
State Superseded
Headers show

Comments

phabricator - Sept. 23, 2020, 4:37 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `dest` is the destination we're rebasing onto, which is always the
  same as `p1` when using `--collapse`. This lets us simplify a bit.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -562,7 +562,6 @@ 
 
     def _rebasenode(self, tr, rev, allowdivergence, progressfn):
         repo, ui, opts = self.repo, self.ui, self.opts
-        dest = self.destmap[rev]
         ctx = repo[rev]
         desc = _ctxdesc(ctx)
         if self.state[rev] == rev:
@@ -616,14 +615,7 @@ 
                 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
                 with ui.configoverride(overrides, b'rebase'):
                     stats = rebasenode(
-                        repo,
-                        rev,
-                        p1,
-                        p2,
-                        base,
-                        self.collapsef,
-                        dest,
-                        wctx=self.wctx,
+                        repo, rev, p1, p2, base, self.collapsef, wctx=self.wctx,
                     )
                     if stats.unresolvedcount > 0:
                         if self.inmemory:
@@ -1465,7 +1457,7 @@ 
         return newnode
 
 
-def rebasenode(repo, rev, p1, p2, base, collapse, dest, wctx):
+def rebasenode(repo, rev, p1, p2, base, collapse, wctx):
     """Rebase a single revision rev on top of p1 using base as merge ancestor"""
     # Merge phase
     # Update to destination and merge it with local
@@ -1501,7 +1493,7 @@ 
     )
     wctx.setparents(p1ctx.node(), repo[p2].node())
     if collapse:
-        copies.graftcopies(wctx, ctx, repo[dest])
+        copies.graftcopies(wctx, ctx, p1ctx)
     else:
         # If we're not using --collapse, we need to
         # duplicate copies between the revision we're