Patchwork D7906: rebase: define base in only place in defineparents()

login
register
mail settings
Submitter phabricator
Date Jan. 30, 2020, 3:39 p.m.
Message ID <e44212b9cd606ad8d46373151df50dd2@localhost.localdomain>
Download mbox | patch
Permalink /patch/44779/
State Not Applicable
Headers show

Comments

phabricator - Jan. 30, 2020, 3:39 p.m.
Closed by commit rHG0712c5e86b9c: rebase: define base in only place in defineparents() (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/D7906?vs=19698&id=19720

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

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1739,12 +1739,6 @@ 
     if any(p != nullrev and isancestor(rev, p) for p in newps):
         raise error.Abort(_(b'source is ancestor of destination'))
 
-    # "rebasenode" updates to new p1, use the corresponding merge base.
-    if bases[0] != nullrev:
-        base = bases[0]
-    else:
-        base = None
-
     # Check if the merge will contain unwanted changes. That may happen if
     # there are multiple special (non-changelog ancestor) merge bases, which
     # cannot be handled well by the 3-way merge algorithm. For example:
@@ -1809,14 +1803,20 @@ 
                 % (rev, repo[rev], unwanteddesc)
             )
 
-        base = bases[i]
-
         # newps[0] should match merge base if possible. Currently, if newps[i]
         # is nullrev, the only case is newps[i] and newps[j] (j < i), one is
         # the other's ancestor. In that case, it's fine to not swap newps here.
         # (see CASE-1 and CASE-2 above)
-        if i != 0 and newps[i] != nullrev:
-            newps[0], newps[i] = newps[i], newps[0]
+        if i != 0:
+            if newps[i] != nullrev:
+                newps[0], newps[i] = newps[i], newps[0]
+            bases[0], bases[i] = bases[i], bases[0]
+
+    # "rebasenode" updates to new p1, use the corresponding merge base.
+    if bases[0] != nullrev:
+        base = bases[0]
+    else:
+        base = None
 
     repo.ui.debug(b" future parents are %d and %d\n" % tuple(newps))