Patchwork D211: tests: demonstrate broken rebase of merge with p1's successor in dest

login
register
mail settings
Submitter phabricator
Date Aug. 2, 2017, 5:10 a.m.
Message ID <differential-rev-PHID-DREV-dy22k4ks4ehzwahzw3c3-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22628/
State Superseded
Headers show

Comments

phabricator - Aug. 2, 2017, 5:10 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The fix in https://phab.mercurial-scm.org/rHG8ede973597fda1368d1b867e7293ef812c82c2ab (rebase: handle successor targets (issue5198),
  2016-04-11) only fixed the case where p2's successor was in the
  destination, and only when the successor was exactly the destination
  (i.e. not when the successor was an ancestor of it). This patch adds a
  test case for when p1's successor is in the destination. It adds
  another one for when the successor is an ancestor of the
  destination. To do that simply, it also rewrites the test case using
  drawdag.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-rebase-obsolete.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Aug. 2, 2017, 8:01 p.m.
quark accepted this revision.
quark added a comment.


  Looks great! Thanks for finding and documenting these tricky cases!
  
  There are a few places that might miss some English words. Those could probably be fixed in flight.

INLINE COMMENTS

> test-rebase-obsolete.t:960
> +
> +Rebase merge with successor of one parent ancestor of destination
> +

`s/parent ancestor/parent being ancestor/g` ?

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - Aug. 2, 2017, 8:10 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> quark wrote in test-rebase-obsolete.t:960
> `s/parent ancestor/parent being ancestor/g` ?

Hmm, that didn't read very well (my version of it). I rephrased it slightly differently.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -13,6 +13,7 @@ 
   > publish=False
   > [extensions]
   > rebase=
+  > drawdag=$TESTDIR/drawdag.py
   > EOF
 
 Setup rebase canonical repo
@@ -896,55 +897,202 @@ 
   rebasing 22:7bdc8a87673d "dummy change" (tip)
   $ cd ..
 
-rebase source is obsoleted (issue5198)
----------------------------------
+Rebase merge with successor of one parent equal to destination (issue5198)
+
+  $ hg init p1-succ-is-dest
+  $ cd p1-succ-is-dest
 
-  $ hg clone base amended
-  updating to branch default
-  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cd amended
-  $ hg up 9520eea781bc
-  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ echo 1 >> E
-  $ hg commit --amend -m "E'" -d "0 0"
+  $ hg debugdrawdag <<EOF
+  >   F
+  >  /|
+  > E D B # replace: D -> B
+  >  \|/
+  >   A
+  > EOF
+
+  $ hg rebase -d B -s D
+  note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B"
+  rebasing 4:66f1a38021c9 "F" (F tip)
   $ hg log -G
-  @  9:69abe8906104 E'
-  |
-  | o  7:02de42196ebe H
-  | |
-  | | o  6:eea13746799a G
+  o    5:50e9d60b99c6 F
+  |\
+  | | x  4:66f1a38021c9 F
   | |/|
-  | o |  5:24b6387c8c8c F
-  |/ /
-  | x  4:9520eea781bc E
+  | o |  3:7fb047a69f22 E
+  | | |
+  | | x  2:b18e25de2cf5 D
+  | |/
+  o |  1:112478962961 B
   |/
-  | o  3:32af7686d403 D
+  o  0:426bada5c675 A
+  
+  $ cd ..
+
+Rebase merge with successor of other parent equal to destination
+
+  $ hg init p2-succ-is-dest
+  $ cd p2-succ-is-dest
+
+  $ hg debugdrawdag <<EOF
+  >   F
+  >  /|
+  > E D B # replace: E -> B
+  >  \|/
+  >   A
+  > EOF
+
+BROKEN: Raises an exception
+  $ hg rebase -d B -s E 2>&1 | grep AssertionError:
+  AssertionError: no base found to rebase on (defineparents called wrong)
+  $ hg log -G
+  o    4:66f1a38021c9 F
+  |\
+  | x  3:7fb047a69f22 E
   | |
-  | o  2:5fddd98957c8 C
-  | |
-  | o  1:42ccdea3bb16 B
+  o |  2:b18e25de2cf5 D
   |/
-  o  0:cd010b8cd998 A
+  | o  1:112478962961 B
+  |/
+  o  0:426bada5c675 A
   
-  $ hg rebase -d . -s 9520eea781bc
-  note: not rebasing 4:9520eea781bc "E", already in destination as 9:69abe8906104 "E'"
-  rebasing 6:eea13746799a "G"
+  $ cd ..
+
+Rebase merge with successor of one parent ancestor of destination
+
+  $ hg init p1-succ-in-dest
+  $ cd p1-succ-in-dest
+
+  $ hg debugdrawdag <<EOF
+  >   F C
+  >  /| |
+  > E D B # replace: D -> B
+  >  \|/
+  >   A
+  > EOF
+
+  $ hg rebase -d C -s D
+  note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B"
+  rebasing 5:66f1a38021c9 "F" (F tip)
+BROKEN: not rebased on top of requested destination (C)
   $ hg log -G
-  o    10:17be06e82e95 G
+  o    6:50e9d60b99c6 F
+  |\
+  | | x  5:66f1a38021c9 F
+  | |/|
+  +-----o  4:26805aba1e60 C
+  | | |
+  | o |  3:7fb047a69f22 E
+  | | |
+  | | x  2:b18e25de2cf5 D
+  | |/
+  o |  1:112478962961 B
+  |/
+  o  0:426bada5c675 A
+  
+  $ cd ..
+
+Rebase merge with successor of other parent ancestor of destination
+
+  $ hg init p2-succ-in-dest
+  $ cd p2-succ-in-dest
+
+  $ hg debugdrawdag <<EOF
+  >   F C
+  >  /| |
+  > E D B # replace: E -> B
+  >  \|/
+  >   A
+  > EOF
+
+BROKEN: Raises an exception
+  $ hg rebase -d C -s E 2>&1 | grep AssertionError:
+  AssertionError: no base found to rebase on (defineparents called wrong)
+  $ hg log -G
+  o    5:66f1a38021c9 F
   |\
-  | @  9:69abe8906104 E'
-  | |
-  +---o  7:02de42196ebe H
-  | |
-  o |  5:24b6387c8c8c F
+  | | o  4:26805aba1e60 C
+  | | |
+  | x |  3:7fb047a69f22 E
+  | | |
+  o | |  2:b18e25de2cf5 D
+  |/ /
+  | o  1:112478962961 B
   |/
-  | o  3:32af7686d403 D
-  | |
-  | o  2:5fddd98957c8 C
-  | |
-  | o  1:42ccdea3bb16 B
+  o  0:426bada5c675 A
+  
+  $ cd ..
+
+Rebase merge with successor of one parent in destination
+
+  $ hg init p1-succ-in-dest-b
+  $ cd p1-succ-in-dest-b
+
+  $ hg debugdrawdag <<EOF
+  >   F C
+  >  /| |
+  > E D B # replace: E -> B
+  >  \|/
+  >   A
+  > EOF
+
+  $ hg rebase -d C -b F
+  rebasing 2:b18e25de2cf5 "D" (D)
+  note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B"
+  rebasing 5:66f1a38021c9 "F" (F tip)
+  $ hg log -G
+  o  7:9ed45af61fa0 F
+  |
+  o  6:8f47515dda15 D
+  |
+  | x    5:66f1a38021c9 F
+  | |\
+  o | |  4:26805aba1e60 C
+  | | |
+  | | x  3:7fb047a69f22 E
+  | | |
+  | x |  2:b18e25de2cf5 D
+  | |/
+  o /  1:112478962961 B
   |/
-  o  0:cd010b8cd998 A
+  o  0:426bada5c675 A
+  
+  $ cd ..
+
+Rebase merge with successor of other parent in destination
+
+  $ hg init p2-succ-in-dest-b
+  $ cd p2-succ-in-dest-b
+
+  $ hg debugdrawdag <<EOF
+  >   F C
+  >  /| |
+  > E D B # replace: D -> B
+  >  \|/
+  >   A
+  > EOF
+
+  $ hg rebase -d C -b F
+  note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B"
+  rebasing 3:7fb047a69f22 "E" (E)
+  rebasing 5:66f1a38021c9 "F" (F tip)
+BROKEN: This should have resulted in a rebased F with one parent, just like in
+the test case above
+  $ hg log -G
+  o    7:c1e6f26e339d F
+  |\
+  | o  6:533690786a86 E
+  |/
+  | x    5:66f1a38021c9 F
+  | |\
+  o | |  4:26805aba1e60 C
+  | | |
+  | | x  3:7fb047a69f22 E
+  | | |
+  | x |  2:b18e25de2cf5 D
+  | |/
+  o /  1:112478962961 B
+  |/
+  o  0:426bada5c675 A
   
   $ cd ..