next: add extensive testing to the 'next' command
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 24 Jun 2015 21:16:57 -0700
changeset 1445 6fd6c98f9f70
parent 1444 9a78233c62a4
child 1446 a73d1ee48003
next: add extensive testing to the 'next' command We are going to introduce more complexity to it. We add the full extend of the case we want tested to see how they evolve later.
tests/test-prev-next.t
--- a/tests/test-prev-next.t	Wed Jun 24 19:43:35 2015 -0700
+++ b/tests/test-prev-next.t	Wed Jun 24 21:16:57 2015 -0700
@@ -104,3 +104,85 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [1] added b
 
+Behavior with aspiring children
+-------------------------------
+
+  $ hg revert --all
+  forgetting modified-bar
+  $ hg log -G
+  o  changeset:   2:4e26ef31f919
+  |  bookmark:    mark
+  |  bookmark:    no-move
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     added c
+  |
+  @  changeset:   1:6e742c9127b3
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     added b
+  |
+  o  changeset:   0:a154386e50d1
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     added a
+  
+
+no children of any kind
+
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [2] added c
+  $ hg next
+  no non-obsolete children
+  [1]
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added b
+
+some aspiring children
+
+  $ hg amend -m 'added b (2)'
+  1 new unstable changesets
+  $ hg next
+  no non-obsolete children
+  [1]
+  $ hg evolve
+  move:[2] added c
+  atop:[3] added b (2)
+  working directory is now at e3b6d5df389b
+
+next with ambiguity
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [3] added b (2)
+  $ echo d > d
+  $ hg add d
+  $ hg commit -m 'added d'
+  created new head
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [3] added b (2)
+  $ hg next
+  [4] added c
+  [5] added d
+  multiple non-obsolete children, explicitly update to one of them
+  [1]
+
+next with ambiguity in aspiring children
+
+  $ hg am -m 'added b (3)'
+  2 new unstable changesets
+  $ hg next
+  no non-obsolete children
+  [1]
+  $ hg evolve
+  abort: multiple evolve candidates
+  (select one of e3b6d5df389b, 9df671ccd2c7 with --rev)
+  [255]
+  $ hg evolve -r 5
+  move:[5] added d
+  atop:[6] added b (3)
+  working directory is now at 47ea25be8aea