next: add test which shows that `next` get confused by split
authorSushil khanchi <sushilkhanchi97@gmail.com>
Tue, 06 Nov 2018 15:10:56 +0530
changeset 4251 a5ec7652c4f4
parent 4250 781d058d14f9
child 4252 a07cd1d076bb
next: add test which shows that `next` get confused by split
tests/test-prev-next.t
--- a/tests/test-prev-next.t	Wed Oct 31 14:08:56 2018 +0530
+++ b/tests/test-prev-next.t	Tue Nov 06 15:10:56 2018 +0530
@@ -483,3 +483,114 @@
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges
   [2] added bar
+
+Add test which shows that `next` command get confused by split:
+---------------------------------------------------------------
+  $ cd ..
+  $ mkdir nextconfused
+  $ cd nextconfused
+  $ hg init
+  $ echo firstline > a
+  $ hg add a
+  $ hg ci -qm A
+  $ echo bbbbb > b
+  $ echo secondline >> a
+  $ hg add b
+  $ hg ci -qm B
+  $ echo ccccc > c
+  $ hg add c
+  $ hg ci -qm C
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  2:fdc998261dcb C
+  |
+  o  1:cc0edb0cc2b1 B
+  |
+  o  0:cae96ff49c84 A
+  
+  $ hg up 1
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg split << EOF
+  > y
+  > y
+  > n
+  > N
+  > y
+  > y
+  > EOF
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  reverting a
+  adding b
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,1 +1,2 @@
+   firstline
+  +secondline
+  record change 1/2 to 'a'? [Ynesfdaq?] y
+  
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] n
+  
+  created new head
+  Done splitting? [yN] N
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +bbbbb
+  record this change to 'b'? [Ynesfdaq?] y
+  
+  no more change to split
+  1 new orphan changesets
+
+  $ hg up 3 -q
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  o  4:279f6cab32b5 B
+  |
+  |
+  |  new desc
+  @  3:a9f74d07e45c B
+  |
+  |
+  |  new desc
+  | *  2:fdc998261dcb C
+  | |
+  | x  1:cc0edb0cc2b1 B
+  |/
+  o  0:cae96ff49c84 A
+  
+  $ hg ci --amend -m "B modified"
+  1 new orphan changesets
+  $ hg log -GT "{rev}:{node|short} {desc}\n"
+  @  5:64ab03d3110c B modified
+  |
+  | *  4:279f6cab32b5 B
+  | |
+  | |
+  | |  new desc
+  | x  3:a9f74d07e45c B
+  |/
+  |
+  |    new desc
+  | *  2:fdc998261dcb C
+  | |
+  | x  1:cc0edb0cc2b1 B
+  |/
+  o  0:cae96ff49c84 A
+  
+  $ hg next --evolve << EOF
+  > q
+  > EOF
+  ambiguous next (unstable) changeset, choose one to evolve and update:
+  0: [fdc998261dcb] C
+  1: [279f6cab32b5] B
+  q: quit the prompt
+  enter the index of the revision you want to select: q
+  ambiguous next (unstable) changeset:
+  [2] C
+  [4] B
+  (run 'hg evolve --rev REV' on one of them)
+  [1]