tests: add tests for `hg stack` showing surprising behavior with gaps
The test will help us to analyse in next commit if the things are fixed or not.
--- a/tests/test-topic-stack.t Sun Sep 10 22:22:06 2017 +0900
+++ b/tests/test-topic-stack.t Thu Sep 07 16:45:57 2017 +0200
@@ -430,3 +430,123 @@
abort: cannot resolve "thisdoesnotexist": no such topic found
[255]
+Complex cases where commits with same topic are not consecutive but are linear
+==============================================================================
+
+ $ hg log --graph
+ o 15 default {foo} draft c_h
+ |
+ o 14 default {foo} draft c_g
+ |
+ @ 13 default {foo} draft c_D
+ |
+ | o 9 default {foo} draft c_f
+ | |
+ | o 8 default {foo} draft c_e
+ | |
+ | x 7 default {foo} draft c_d
+ |/
+ o 2 default {foo} draft c_c
+ |
+ o 1 default {} public c_b
+ |
+ o 0 default {} public c_a
+
+Converting into a linear chain
+ $ hg rebase -s 8 -d 15
+ rebasing 8:215bc359096a "c_e"
+ rebasing 9:ec9267b3f33f "c_f"
+
+ $ hg log -G
+ o 17 default {foo} draft c_f
+ |
+ o 16 default {foo} draft c_e
+ |
+ o 15 default {foo} draft c_h
+ |
+ o 14 default {foo} draft c_g
+ |
+ @ 13 default {foo} draft c_D
+ |
+ o 2 default {foo} draft c_c
+ |
+ o 1 default {} public c_b
+ |
+ o 0 default {} public c_a
+
+Changing topics on some commits in between
+ $ hg topic foobar -r 'desc(c_e) + desc(c_D)'
+ switching to topic foobar
+ changed topic on 2 changes
+ $ hg log -G
+ @ 19 default {foobar} draft c_D
+ |
+ | o 18 default {foobar} draft c_e
+ | |
+ | | o 17 default {foo} draft c_f
+ | | |
+ | | x 16 default {foo} draft c_e
+ | |/
+ | o 15 default {foo} draft c_h
+ | |
+ | o 14 default {foo} draft c_g
+ | |
+ | x 13 default {foo} draft c_D
+ |/
+ o 2 default {foo} draft c_c
+ |
+ o 1 default {} public c_b
+ |
+ o 0 default {} public c_a
+
+ $ hg rebase -s 17 -d 18
+ rebasing 17:77082e55de88 "c_f"
+ switching to topic foo
+ switching to topic foobar
+ $ hg rebase -s 14 -d 19
+ rebasing 14:0c3e8aed985d "c_g"
+ switching to topic foo
+ rebasing 15:b9e4f3709bc5 "c_h"
+ rebasing 18:4bc813530301 "c_e"
+ switching to topic foobar
+ rebasing 20:4406ea4be852 "c_f" (tip)
+ switching to topic foo
+ switching to topic foobar
+ $ hg up
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg log --graph
+ o 24 default {foo} draft c_f
+ |
+ @ 23 default {foobar} draft c_e
+ |
+ o 22 default {foo} draft c_h
+ |
+ o 21 default {foo} draft c_g
+ |
+ o 19 default {foobar} draft c_D
+ |
+ o 2 default {foo} draft c_c
+ |
+ o 1 default {} public c_b
+ |
+ o 0 default {} public c_a
+
+XXX: The following should show single heads
+ $ hg stack
+ ### topic: foobar (2 heads)
+ ### branch: default, 3 behind
+ t2: c_D
+ ^ c_c
+ t1@ c_e (current)
+ t0^ c_h (base)
+
+ $ hg stack foo
+ ### topic: foo (3 heads)
+ ### branch: default, ambigious rebase destination
+ t4: c_c
+ ^ c_b
+ t3: c_h
+ t2: c_g
+ ^ c_D
+ t1: c_f
+ t0^ c_e (base)