Patchwork [stable] rebase: better way to detect non-detaching revisions (issue5044)

login
register
mail settings
Submitter Martijn Pieters
Date Feb. 1, 2016, 3:55 p.m.
Message ID <1f55d3f6f9680a108bd3.1454342114@mjpieters-mbp>
Download mbox | patch
Permalink /patch/12934/
State Accepted
Headers show

Comments

Martijn Pieters - Feb. 1, 2016, 3:55 p.m.
# HG changeset patch
# User Martijn Pieters <mj@zopatista.com>
# Date 1454341303 0
#      Mon Feb 01 15:41:43 2016 +0000
# Branch stable
# Node ID 1f55d3f6f9680a108bd37138126071bf2cc745a7
# Parent  2283f63d7548953788b440bf532c0dda71d2800f
rebase: better way to detect non-detaching revisions (issue5044)

Rather than look for the lowest revision, see if the rebase state is tracking
the parents of this revision. Otherwise we can't handle multiple revisions in
one rebase that includes a merge revision.

Fixes issue5044.
Pierre-Yves David - Feb. 1, 2016, 5:47 p.m.
On 02/01/2016 03:55 PM, Martijn Pieters wrote:
> # HG changeset patch
> # User Martijn Pieters <mj@zopatista.com>
> # Date 1454341303 0
> #      Mon Feb 01 15:41:43 2016 +0000
> # Branch stable
> # Node ID 1f55d3f6f9680a108bd37138126071bf2cc745a7
> # Parent  2283f63d7548953788b440bf532c0dda71d2800f
> rebase: better way to detect non-detaching revisions (issue5044)

Pushed to the clowncopter, many thanks.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -712,8 +712,8 @@ 
     repo.ui.debug(" future parents are %d and %d\n" %
                             (repo[p1].rev(), repo[p2].rev()))
 
-    if rev == min(state):
-        # Case (1) initial changeset of a non-detaching rebase.
+    if not any(p.rev() in state for p in parents):
+        # Case (1) root changeset of a non-detaching rebase set.
         # Let the merge mechanism find the base itself.
         base = None
     elif not repo[rev].p2():
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -412,6 +412,16 @@ 
   
   $ cd ..
 
+Rebasing both a single revision and a merge in one command
+
+  $ hg clone -q -u . a aX
+  $ cd aX
+  $ hg rebase -r 3 -r 6
+  rebasing 3:32af7686d403 "D"
+  rebasing 6:eea13746799a "G"
+  saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-backup.hg (glob)
+  $ cd ..
+
 Test --tool parameter:
 
   $ hg init b