D2910: tests: use drawdag in test-rebase-collapse.t

2018-03-21 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdd2833e4d660: tests: use drawdag in test-rebase-collapse.t 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2910?vs=7173=7202

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

AFFECTED FILES
  tests/test-rebase-collapse.t

CHANGE DETAILS

diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -2,6 +2,7 @@
   > [extensions]
   > rebase=
   > mq=
+  > drawdag=$TESTDIR/drawdag.py
   > 
   > [phases]
   > publish=False
@@ -11,58 +12,32 @@
   > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' 
{branches}\n"
   > EOF
 
-Create repo a:
-
-  $ hg init a
-  $ cd a
-  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
-  adding changesets
-  adding manifests
-  adding file changes
-  added 8 changesets with 7 changes to 7 files (+2 heads)
-  new changesets cd010b8cd998:02de42196ebe
-  (run 'hg heads' to see heads, 'hg merge' to merge)
-  $ hg up tip
-  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Highest phase of source commits is used:
 
-  $ hg tglog
-  @  7: 02de42196ebe 'H'
-  |
-  | o  6: eea13746799a 'G'
-  |/|
-  o |  5: 24b6387c8c8c 'F'
-  | |
-  | o  4: 9520eea781bc 'E'
-  |/
-  | o  3: 32af7686d403 'D'
-  | |
-  | o  2: 5fddd98957c8 'C'
-  | |
-  | o  1: 42ccdea3bb16 'B'
-  |/
-  o  0: cd010b8cd998 'A'
-  
-  $ cd ..
+  $ hg init phase
+  $ cd phase
+  $ hg debugdrawdag << 'EOF'
+  >   D
+  >   |
+  > F C
+  > | |
+  > E B
+  > |/
+  > A
+  > EOF
 
-
-Rebasing B onto H and collapsing changesets with different phases:
-
-
-  $ hg clone -q -u 3 a a1
-  $ cd a1
-
-  $ hg phase --force --secret 3
+  $ hg phase --force --secret D
 
   $ cat > $TESTTMP/editor.sh < echo " before editing"
   > cat \$1
   > echo ""
   > echo "edited manually" >> \$1
   > EOF
-  $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e 
--dest 7
-  rebasing 1:42ccdea3bb16 "B"
-  rebasing 2:5fddd98957c8 "C"
-  rebasing 3:32af7686d403 "D"
+  $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e 
--dest F
+  rebasing 1:112478962961 "B" (B)
+  rebasing 3:26805aba1e60 "C" (C)
+  rebasing 5:f585351a92f8 "D" (D tip)
    before editing
   Collapsed revision
   * B
@@ -73,229 +48,169 @@
   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
   HG: Leave message empty to abort commit.
   HG: --
-  HG: user: Nicolas Dumazet 
+  HG: user: test
   HG: branch 'default'
   HG: added B
   HG: added C
   HG: added D
   
-  saved backup bundle to 
$TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
+  saved backup bundle to 
$TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
 
   $ hg tglogp
-  @  5: 30882080ba93 secret 'Collapsed revision
+  o  3: 92fa5f5fe108 secret 'Collapsed revision
   |  * B
   |  * C
   |  * D
   |
   |
   |  edited manually'
-  o  4: 02de42196ebe draft 'H'
+  o  2: 64a8289d2492 draft 'F'
   |
-  | o  3: eea13746799a draft 'G'
-  |/|
-  o |  2: 24b6387c8c8c draft 'F'
-  | |
-  | o  1: 9520eea781bc draft 'E'
-  |/
-  o  0: cd010b8cd998 draft 'A'
+  o  1: 7fb047a69f22 draft 'E'
+  |
+  o  0: 426bada5c675 draft 'A'
   
   $ hg manifest --rev tip
   A
   B
   C
   D
+  E
   F
-  H
 
   $ cd ..
 
 
-Rebasing E onto H:
+Merge gets linearized:
 
-  $ hg clone -q -u . a a2
-  $ cd a2
+  $ hg init linearized-merge
+  $ cd linearized-merge
 
-  $ hg phase --force --secret 6
-  $ hg rebase --source 4 --collapse --dest 7
-  rebasing 4:9520eea781bc "E"
-  rebasing 6:eea13746799a "G"
-  saved backup bundle to 
$TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
+  $ hg debugdrawdag << 'EOF'
+  > F D
+  > |/|
+  > C B
+  > |/
+  > A
+  > EOF
+
+  $ hg phase --force --secret D
+  $ hg rebase --source B --collapse --dest F
+  rebasing 1:112478962961 "B" (B)
+  rebasing 3:4e4f9194f9f1 "D" (D)
+  saved backup bundle to 
$TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
 
   $ hg tglog
-  o  6: 7dd333a2d1e4 'Collapsed revision
-  |  * E
-  |  * G'
-  @  5: 02de42196ebe 'H'
-  |
-  o  4: 24b6387c8c8c 'F'
+  o  3: 5bdc08b7da2b 'Collapsed revision
+  |  * B
+  |  * D'
+  o  2: afc707c82df0 'F'
   |
-  | o  3: 32af7686d403 'D'
-  | |
-  | o  2: 5fddd98957c8 'C'
-  | |
-  | o  1: 42ccdea3bb16 'B'
-  |/
-  o  0: cd010b8cd998 'A'
+  o  1: dc0947a82db8 'C'
+  |
+  o  0: 426bada5c675 'A'
   
   $ hg manifest --rev tip
   A
-  E
+  B
+  C
   F
-  H
 
   $ cd ..
 
-Rebasing G onto H with custom message:
+Custom message:
+
+  $ hg init message
+  $ cd message
 
-  $ hg clone -q -u . a a3
-  $ cd a3
+  $ hg debugdrawdag << 'EOF'
+  >   C
+  >   |
+  > D B
+  > |/
+  > A
+  > EOF
 
-  $ hg rebase --base 6 -m 'custom message'
+
+  $ hg rebase --base B -m 'custom message'
   abort: message can only be specified 

D2910: tests: use drawdag in test-rebase-collapse.t

2018-03-21 Thread indygreg (Gregory Szorc)
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  This was hard to review. But I didn't see anything obviously wrong with this 
refactor.

INLINE COMMENTS

> test-rebase-collapse.t:182
> +  $ hg rebase -s C --dest H --collapse
> +  abort: unable to collapse on top of 3, there is more than one external 
> parent: 1, 6
>[255]

Are we really printing revision numbers here?!

REPOSITORY
  rHG Mercurial

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

To: martinvonz, phillco, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2910: tests: use drawdag in test-rebase-collapse.t

2018-03-21 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
martinvonz added a reviewer: phillco.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes the tests shorter (410 lines -> 240 lines), faster (17s ->
  12s), and easier to read (the setup for each test case is just before
  the test, and we can refer to commits by name).

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-rebase-collapse.t

CHANGE DETAILS

diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -2,6 +2,7 @@
   > [extensions]
   > rebase=
   > mq=
+  > drawdag=$TESTDIR/drawdag.py
   > 
   > [phases]
   > publish=False
@@ -11,58 +12,32 @@
   > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' 
{branches}\n"
   > EOF
 
-Create repo a:
-
-  $ hg init a
-  $ cd a
-  $ hg unbundle "$TESTDIR/bundles/rebase.hg"
-  adding changesets
-  adding manifests
-  adding file changes
-  added 8 changesets with 7 changes to 7 files (+2 heads)
-  new changesets cd010b8cd998:02de42196ebe
-  (run 'hg heads' to see heads, 'hg merge' to merge)
-  $ hg up tip
-  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Highest phase of source commits is used:
 
-  $ hg tglog
-  @  7: 02de42196ebe 'H'
-  |
-  | o  6: eea13746799a 'G'
-  |/|
-  o |  5: 24b6387c8c8c 'F'
-  | |
-  | o  4: 9520eea781bc 'E'
-  |/
-  | o  3: 32af7686d403 'D'
-  | |
-  | o  2: 5fddd98957c8 'C'
-  | |
-  | o  1: 42ccdea3bb16 'B'
-  |/
-  o  0: cd010b8cd998 'A'
-  
-  $ cd ..
+  $ hg init phase
+  $ cd phase
+  $ hg debugdrawdag << 'EOF'
+  >   D
+  >   |
+  > F C
+  > | |
+  > E B
+  > |/
+  > A
+  > EOF
 
-
-Rebasing B onto H and collapsing changesets with different phases:
-
-
-  $ hg clone -q -u 3 a a1
-  $ cd a1
-
-  $ hg phase --force --secret 3
+  $ hg phase --force --secret D
 
   $ cat > $TESTTMP/editor.sh < echo " before editing"
   > cat \$1
   > echo ""
   > echo "edited manually" >> \$1
   > EOF
-  $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e 
--dest 7
-  rebasing 1:42ccdea3bb16 "B"
-  rebasing 2:5fddd98957c8 "C"
-  rebasing 3:32af7686d403 "D"
+  $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e 
--dest F
+  rebasing 1:112478962961 "B" (B)
+  rebasing 3:26805aba1e60 "C" (C)
+  rebasing 5:f585351a92f8 "D" (D tip)
    before editing
   Collapsed revision
   * B
@@ -73,229 +48,169 @@
   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
   HG: Leave message empty to abort commit.
   HG: --
-  HG: user: Nicolas Dumazet 
+  HG: user: test
   HG: branch 'default'
   HG: added B
   HG: added C
   HG: added D
   
-  saved backup bundle to 
$TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
+  saved backup bundle to 
$TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
 
   $ hg tglogp
-  @  5: 30882080ba93 secret 'Collapsed revision
+  o  3: 92fa5f5fe108 secret 'Collapsed revision
   |  * B
   |  * C
   |  * D
   |
   |
   |  edited manually'
-  o  4: 02de42196ebe draft 'H'
+  o  2: 64a8289d2492 draft 'F'
   |
-  | o  3: eea13746799a draft 'G'
-  |/|
-  o |  2: 24b6387c8c8c draft 'F'
-  | |
-  | o  1: 9520eea781bc draft 'E'
-  |/
-  o  0: cd010b8cd998 draft 'A'
+  o  1: 7fb047a69f22 draft 'E'
+  |
+  o  0: 426bada5c675 draft 'A'
   
   $ hg manifest --rev tip
   A
   B
   C
   D
+  E
   F
-  H
 
   $ cd ..
 
 
-Rebasing E onto H:
+Merge gets linearized:
 
-  $ hg clone -q -u . a a2
-  $ cd a2
+  $ hg init linearized-merge
+  $ cd linearized-merge
 
-  $ hg phase --force --secret 6
-  $ hg rebase --source 4 --collapse --dest 7
-  rebasing 4:9520eea781bc "E"
-  rebasing 6:eea13746799a "G"
-  saved backup bundle to 
$TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
+  $ hg debugdrawdag << 'EOF'
+  > F D
+  > |/|
+  > C B
+  > |/
+  > A
+  > EOF
+
+  $ hg phase --force --secret D
+  $ hg rebase --source B --collapse --dest F
+  rebasing 1:112478962961 "B" (B)
+  rebasing 3:4e4f9194f9f1 "D" (D)
+  saved backup bundle to 
$TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
 
   $ hg tglog
-  o  6: 7dd333a2d1e4 'Collapsed revision
-  |  * E
-  |  * G'
-  @  5: 02de42196ebe 'H'
-  |
-  o  4: 24b6387c8c8c 'F'
+  o  3: 5bdc08b7da2b 'Collapsed revision
+  |  * B
+  |  * D'
+  o  2: afc707c82df0 'F'
   |
-  | o  3: 32af7686d403 'D'
-  | |
-  | o  2: 5fddd98957c8 'C'
-  | |
-  | o  1: 42ccdea3bb16 'B'
-  |/
-  o  0: cd010b8cd998 'A'
+  o  1: dc0947a82db8 'C'
+  |
+  o  0: 426bada5c675 'A'
   
   $ hg manifest --rev tip
   A
-  E
+  B
+  C
   F
-  H
 
   $ cd ..
 
-Rebasing G onto H with custom message:
+Custom message:
+
+  $ hg init message
+  $ cd message
 
-  $ hg clone -q -u . a a3
-  $ cd a3
+  $ hg debugdrawdag << 'EOF'
+  >   C
+  >   |
+  > D B
+  > |/
+  > A
+  > EOF
 
-  $ hg rebase --base 6 -m 'custom