diff tests/test-topic-dest.t @ 1891:077c40f206d1

rebase: test default rebase destination behavior In future mercurial 3.8, rebase and merge share the same destination logic. So if merge work, rebase should work as well. However, we double test it to be sure. Especially, in 3.7 the logic is not shared so we have to introduce an extra hack to share it in this case.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 13 Mar 2016 13:07:54 +0000
parents d49f75eab6a3
children b1fadc089b82
line wrap: on
line diff
--- a/tests/test-topic-dest.t	Sun Mar 13 23:44:04 2016 +0000
+++ b/tests/test-topic-dest.t	Sun Mar 13 13:07:54 2016 +0000
@@ -96,25 +96,23 @@
   $ hg log -r 'default'
   6 () c_epsilon
 
-merge destination
-=================
+rebase destination
+==================
+
+rebase on branch ngtip
 
-  $ hg up 'ngtip(default)'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg up default
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ echo zeta >> zeta
-  $ hg add zeta
-  $ hg ci -m "c_zeta"
+  $ hg up elephant
+  switching to topic elephant
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rebase
+  rebasing 4:cb7ae72f4a80 "babar"
   $ hg log -G
-  @  7 () c_zeta
+  @  7 (elephant) babar
   |
   o  6 () c_epsilon
   |
   | o  5 (monkey) zephir
   | |
-  +---o  4 (elephant) babar
-  | |
   o |  3 () c_delta
   | |
   o |  2 () c_gamma
@@ -123,16 +121,111 @@
   |
   o  0 () c_alpha
   
+  $ hg up monkey
+  switching to topic monkey
+  1 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ hg rebase
+  rebasing 5:d832ddc604ec "zephir"
+  $ hg log -G
+  @  8 (monkey) zephir
+  |
+  | o  7 (elephant) babar
+  |/
+  o  6 () c_epsilon
+  |
+  o  3 () c_delta
+  |
+  o  2 () c_gamma
+  |
+  o  1 () c_beta
+  |
+  o  0 () c_alpha
+  
+
+Rebase on other topic heads if any
+
+  $ hg up 'desc(c_delta)'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo "General Huc" >> monkeyville
+  $ hg add monkeyville
+  $ hg ci -t monkey -m Huc
+  created new head
+  $ hg log -G
+  @  9 (monkey) Huc
+  |
+  | o  8 (monkey) zephir
+  | |
+  | | o  7 (elephant) babar
+  | |/
+  | o  6 () c_epsilon
+  |/
+  o  3 () c_delta
+  |
+  o  2 () c_gamma
+  |
+  o  1 () c_beta
+  |
+  o  0 () c_alpha
+  
+  $ hg rebase
+  rebasing 9:d79a104e2902 "Huc" (tip)
+  $ hg log -G
+  @  10 (monkey) Huc
+  |
+  o  8 (monkey) zephir
+  |
+  | o  7 (elephant) babar
+  |/
+  o  6 () c_epsilon
+  |
+  o  3 () c_delta
+  |
+  o  2 () c_gamma
+  |
+  o  1 () c_beta
+  |
+  o  0 () c_alpha
+  
+
+merge destination
+=================
+
+  $ hg up 'ngtip(default)'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg up default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo zeta >> zeta
+  $ hg add zeta
+  $ hg ci -m "c_zeta"
+  $ hg log -G
+  @  11 () c_zeta
+  |
+  | o  10 (monkey) Huc
+  | |
+  | o  8 (monkey) zephir
+  |/
+  | o  7 (elephant) babar
+  |/
+  o  6 () c_epsilon
+  |
+  o  3 () c_delta
+  |
+  o  2 () c_gamma
+  |
+  o  1 () c_beta
+  |
+  o  0 () c_alpha
+  
   $ hg up elephant
   switching to topic elephant
-  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  $ hg rebase -d 7 # make sure tip is elsewhere
-  rebasing 4:cb7ae72f4a80 "babar"
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rebase -d 'desc(c_zeta)' # make sure tip is elsewhere
+  rebasing 7:8d0b77140b05 "babar"
   $ hg up monkey
   switching to topic monkey
-  1 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg merge
-  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg topic
      elephant
@@ -142,20 +235,22 @@
      elephant
    * monkey
   $ hg log -G
-  @    9 (monkey) merge with default
+  @    13 (monkey) merge with default
   |\
-  | | o  8 (elephant) babar
+  | | o  12 (elephant) babar
   | |/
-  | o  7 () c_zeta
+  | o  11 () c_zeta
+  | |
+  o |  10 (monkey) Huc
   | |
-  | o  6 () c_epsilon
-  | |
-  o |  5 (monkey) zephir
-  | |
-  | o  3 () c_delta
-  | |
-  | o  2 () c_gamma
+  o |  8 (monkey) zephir
   |/
+  o  6 () c_epsilon
+  |
+  o  3 () c_delta
+  |
+  o  2 () c_gamma
+  |
   o  1 () c_beta
   |
   o  0 () c_alpha