evolve: add a more complex test for evolve --rev
The previous tests of evolve --rev would have passed with an ordering of revs
by increasing revision numbers. This patch adds a test that would fail if that
was what we were doing and therefore tests the implementation better.
--- a/tests/test-evolve.t Thu Jun 04 13:35:12 2015 -0700
+++ b/tests/test-evolve.t Tue Jun 02 15:23:50 2015 -0700
@@ -22,10 +22,25 @@
> hg ci -m "add $1"
> }
+ $ mkstack() {
+ > # Creates a stack of commit based on $1 with messages from $2, $3 ..
+ > hg update $1 -C
+ > shift
+ > mkcommits $*
+ > }
+
$ glog() {
> hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
> }
+ $ shaof() {
+ > hg log -T {node} -r "first(desc($1))"
+ > }
+
+ $ mkcommits() {
+ > for i in $@; do mkcommit $i ; done
+ > }
+
various init
$ hg init local
@@ -1078,3 +1093,65 @@
atop:[26] add j2
working directory is now at 928e4c317356
+Cleanup to make the tree cleaner
+
+ $ hg prune 20
+ 1 changesets pruned
+ $ hg prune 26::
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ working directory now at 4c0bc042ef3b
+ 2 changesets pruned
+
+evolve --rev reorders the rev to solve instability. Harder case, obsolescence
+accross three stacks in growing rev numbers.
+ $ hg up -C 25
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ mkstack 25 s1_ s2_ s3_ >/dev/null
+ $ mkstack 25 s1prime s2prime >/dev/null
+ $ mkstack 25 s1second >/dev/null
+ $ hg prune `shaof s1_` -s `shaof s1prime`
+ 1 changesets pruned
+ 2 new unstable changesets
+ $ hg prune `shaof s1prime` -s `shaof s1second`
+ 1 changesets pruned
+ 1 new unstable changesets
+ $ hg prune `shaof s2_` -s `shaof s2prime`
+ 1 changesets pruned
+
+ $ glog -r "25::"
+ @ 33:17b5b6ab3f43@default(draft) add s1second
+ |
+ | o 32:d694d85de729@default(draft) add s2prime
+ | |
+ | x 31:1ae988394dc5@default(draft) add s1prime
+ |/
+ | o 30:819245647e79@default(draft) add s3_
+ | |
+ | x 29:07a5fc5c1502@default(draft) add s2_
+ | |
+ | x 28:5ccaf4765b80@default(draft) add s1_
+ |/
+ o 25:4c0bc042ef3b@default(draft) add j1
+ |
+
+ $ hg evolve --rev "25::"
+ move:[32] add s2prime
+ atop:[33] add s1second
+ move:[30] add s3_
+ atop:[34] add s2prime
+ working directory is now at dc79646e43b4
+ $ glog -r "25::"
+ @ 35:dc79646e43b4@default(draft) add s3_
+ |
+ o 34:96f3ff6b7106@default(draft) add s2prime
+ |
+ o 33:17b5b6ab3f43@default(draft) add s1second
+ |
+ o 25:4c0bc042ef3b@default(draft) add j1
+ |
+
+ $ hg prune 33::
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ working directory now at 4c0bc042ef3b
+ 3 changesets pruned
+