changeset 1370:0799c5831a3d

evolve: move test for evolve --rev ordering in a separate file evolve --rev reordering is a complicated enough topic to justify a separate test.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 16 Jun 2015 14:49:28 -0700
parents 4ed67cce8c23
children 30d42079f4a2
files tests/test-evolve-order.t tests/test-evolve.t
diffstat 2 files changed, 142 insertions(+), 232 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-evolve-order.t	Tue Jun 16 14:30:43 2015 -0700
+++ b/tests/test-evolve-order.t	Tue Jun 16 14:49:28 2015 -0700
@@ -27,15 +27,11 @@
 
   $ mkstack() {
   >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
-  >    hg update $1 -C
+  >    hg update "$1" -C
   >    shift
   >    mkcommits $*
   > }
 
-  $ shaof() {
-  >   hg log -T {node} -r "first(desc($1))"
-  > }
-
   $ mkcommits() {
   >   for i in $@; do mkcommit $i ; done
   > }
@@ -74,7 +70,7 @@
 accross three stacks in growing rev numbers.
   $ hg up "desc(_c)"
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ mkcommit d
+  $ mkcommit _d
   $ hg up "desc(_a)"
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ hg amend -m "aprime"
@@ -97,7 +93,7 @@
   | |
   | x  9:81a687b96d4d@default(draft) aprime
   |/
-  | o  8:2d86cc7ec3a9@default(draft) add d
+  | o  8:464731bc0ed0@default(draft) add _d
   | |
   | o  7:52b8f9b04f83@default(draft) add _c
   | |
@@ -112,11 +108,11 @@
   atop:[12] asecond
   move:[7] add _c
   atop:[13] bprime
-  move:[8] add d
+  move:[8] add _d
   atop:[14] add _c
-  working directory is now at fd447ba1b20b
+  working directory is now at 225d2cc5d3fc
   $ hg log -G
-  @  15:fd447ba1b20b@default(draft) add d
+  @  15:225d2cc5d3fc@default(draft) add _d
   |
   o  14:0fc229278e4d@default(draft) add _c
   |
@@ -127,3 +123,115 @@
   o  0:f92638be10c7@default(public) add p
   
 
+Evolve --rev more complex case: two sets of stacks one with prune an no successor, the other one
+partially solvable
+ 
+First set of stack:
+  $ mkstack "desc(_d)" c1_ c2_ c3_ c4_ >/dev/null
+  $ mkstack "desc(_d)" c1prime c2prime >/dev/null
+  $ mkstack "desc(_d)" c1second >/dev/null
+  $ hg prune "desc(c1_)" -s "desc(c1prime)"
+  1 changesets pruned
+  3 new unstable changesets
+  $ hg prune "desc(c2_)" -s "desc(c2prime)"
+  1 changesets pruned
+  $ hg prune "desc(c1prime)" -s "desc(c1second)"
+  1 changesets pruned
+  1 new unstable changesets
+  $ hg log -G -r "desc(_d)::"
+  @  22:a329855d0bc1@default(draft) add c1second
+  |
+  | o  21:072276ece1bf@default(draft) add c2prime
+  | |
+  | x  20:f137acd06692@default(draft) add c1prime
+  |/
+  | o  19:0a1d9b2ce733@default(draft) add c4_
+  | |
+  | o  18:e2874f41c56c@default(draft) add c3_
+  | |
+  | x  17:3247c33339fa@default(draft) add c2_
+  | |
+  | x  16:df322257c182@default(draft) add c1_
+  |/
+  o  15:225d2cc5d3fc@default(draft) add _d
+  |
+
+Second set of stack with no successor for b2_:
+  $ mkstack "desc(_d)" b1_ b2_ b3_ b4_ >/dev/null
+  $ mkstack "desc(_d)" b1prime b3prime >/dev/null
+  $ hg prune "desc(b1_)" -s "desc(b1prime)"
+  1 changesets pruned
+  3 new unstable changesets
+  $ hg prune "desc(b3_)" -s "desc(b3prime)"
+  1 changesets pruned
+  $ hg prune "desc(b2_)"
+  1 changesets pruned
+
+  $ hg log -G -r "desc(_d)::"
+  @  28:ba4c348b6d5e@default(draft) add b3prime
+  |
+  o  27:8fe985f5d0aa@default(draft) add b1prime
+  |
+  | o  26:1d9ba2e75c93@default(draft) add b4_
+  | |
+  | x  25:aec6a9657b6c@default(draft) add b3_
+  | |
+  | x  24:a69b58575918@default(draft) add b2_
+  | |
+  | x  23:3564eb18e448@default(draft) add b1_
+  |/
+  | o  22:a329855d0bc1@default(draft) add c1second
+  |/
+  | o  21:072276ece1bf@default(draft) add c2prime
+  | |
+  | x  20:f137acd06692@default(draft) add c1prime
+  |/
+  | o  19:0a1d9b2ce733@default(draft) add c4_
+  | |
+  | o  18:e2874f41c56c@default(draft) add c3_
+  | |
+  | x  17:3247c33339fa@default(draft) add c2_
+  | |
+  | x  16:df322257c182@default(draft) add c1_
+  |/
+  o  15:225d2cc5d3fc@default(draft) add _d
+  |
+
+Solve the full second stack and only part of the first one
+  $ echo "(desc(_d)::) - desc(c3_)"
+  (desc(_d)::) - desc(c3_)
+  $ hg evolve --rev "(desc(_d)::) - desc(c3_)"
+  cannot solve instability of 0a1d9b2ce733, skipping
+  move:[21] add c2prime
+  atop:[22] add c1second
+  move:[26] add b4_
+  atop:[28] add b3prime
+  working directory is now at 4897c8ed7645
+
+Cleanup
+  $ hg evolve --rev "(desc(_d)::)"
+  move:[18] add c3_
+  atop:[29] add c2prime
+  move:[19] add c4_
+  atop:[31] add c3_
+  working directory is now at 4ee8feb52325
+  $ hg log -G -r "desc(_d)::"
+  @  32:4ee8feb52325@default(draft) add c4_
+  |
+  o  31:08a530ce67e1@default(draft) add c3_
+  |
+  | o  30:4897c8ed7645@default(draft) add b4_
+  | |
+  o |  29:3abc7618dd5f@default(draft) add c2prime
+  | |
+  | o  28:ba4c348b6d5e@default(draft) add b3prime
+  | |
+  | o  27:8fe985f5d0aa@default(draft) add b1prime
+  | |
+  o |  22:a329855d0bc1@default(draft) add c1second
+  |/
+  o  15:225d2cc5d3fc@default(draft) add _d
+  |
+
+
+
--- a/tests/test-evolve.t	Tue Jun 16 14:30:43 2015 -0700
+++ b/tests/test-evolve.t	Tue Jun 16 14:49:28 2015 -0700
@@ -1054,251 +1054,53 @@
   $ hg add j4
   $ hg amend
   2 new unstable changesets
-  $ hg log -G
-  @  25	: add j1 - test
+  $ glog -r "18::"
+  @  25:4c0bc042ef3b@default(draft) add j1
   |
-  | o  23	: add j3 - test
+  | o  23:c70048fd3350@default(draft) add j3
   | |
-  | o  22	: add j2 - test
-  | |
-  | x  21	: add j1 - test
-  |/
-  | o  20	: add gh - test
+  | o  22:714e60ca57b7@default(draft) add j2
   | |
-  o |  19	: add gg - test
+  | x  21:b430835af718@default(draft) add j1
   |/
-  o  18	: a3 - test
-  |
-  o  13	: bumped update to f37ed7a60f43: - test
+  | o  20:db3d894869b0@default(draft) add gh
+  | |
+  o |  19:10ffdd7e3cc9@default(draft) add gg
+  |/
+  o  18:0bb66d4c1968@default(draft) a3
   |
-  o  11	: a2 - test
-  |
-  o  10	testbookmark: a1__ - test
-  |
-  o  0	: a0 - test
-  
 
   $ hg evolve --rev 23
   cannot solve instability of c70048fd3350, skipping
 
-evolve --rev reordering
------------------------
-
-evolve --rev reorders the rev to solve instability, trivial case 2 revs wrong order
-
-  $ hg evolve --rev '23 + 22'
-  move:[22] add j2
-  atop:[25] add j1
-  move:[23] add j3
-  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
-
-Evolve --rev more complex case: two sets of stacks one with prune an no successor, the other one
-partially solvable
-
-First set of stack:
-  $ mkstack 25 c1_ c2_ c3_ c4_ >/dev/null
-  $ mkstack 25 c1prime c2prime >/dev/null
-  $ mkstack 25 c1second >/dev/null
-  $ hg prune `shaof c1_` -s `shaof c1prime`
-  1 changesets pruned
-  3 new unstable changesets
-  $ hg prune `shaof c2_` -s `shaof c2prime`
-  1 changesets pruned
-  $ hg prune `shaof c1prime` -s `shaof c1second`
-  1 changesets pruned
-  1 new unstable changesets
-
-Second set of stack with no successor for b2_:
-  $ mkstack 25 b1_ b2_ b3_ b4_ >/dev/null
-  $ mkstack 25 b1prime b3prime >/dev/null
-  $ hg prune `shaof b1_` -s `shaof b1prime`
-  1 changesets pruned
-  3 new unstable changesets
-  $ hg prune `shaof b3_` -s `shaof b3prime`
-  1 changesets pruned
-  $ hg prune `shaof b2_`
-  1 changesets pruned
-
-  $ glog -r "25::"
-  @  48:2b5cbe59aeca@default(draft) add b3prime
-  |
-  o  47:aa4f5bf8925e@default(draft) add b1prime
-  |
-  | o  46:26b828ec5bcf@default(draft) add b4_
-  | |
-  | x  45:4f07e8c054ba@default(draft) add b3_
-  | |
-  | x  44:3973f60bfa8c@default(draft) add b2_
-  | |
-  | x  43:cddd50881a87@default(draft) add b1_
-  |/
-  | o  42:4a34f6744d4b@default(draft) add c1second
-  |/
-  | o  41:1a00113a0d9a@default(draft) add c2prime
-  | |
-  | x  40:c19e337376fa@default(draft) add c1prime
-  |/
-  | o  39:68e72c885d18@default(draft) add c4_
-  | |
-  | o  38:28172de7eb73@default(draft) add c3_
-  | |
-  | x  37:e2c8f75d4ecc@default(draft) add c2_
-  | |
-  | x  36:4ce6da951588@default(draft) add c1_
-  |/
-  o  25:4c0bc042ef3b@default(draft) add j1
-  |
-
-Solve the full second stack and only part of the first one
-  $ echo "(25::) - $(shaof c3_)"
-  (25::) - 28172de7eb73578cf665e868a265caf2a2655c66
-  $ hg evolve --rev "(25::) - $(shaof c3_)"
-  cannot solve instability of 68e72c885d18, skipping
-  move:[41] add c2prime
-  atop:[42] add c1second
-  move:[46] add b4_
-  atop:[48] add b3prime
-  working directory is now at e543e9e71376
-
-Cleanup
-  $ hg evolve --rev "(25::)"
-  move:[38] add c3_
-  atop:[49] add c2prime
-  move:[39] add c4_
-  atop:[51] add c3_
-  working directory is now at 456e647fbe11
-  $ glog -r "25::"
-  @  52:456e647fbe11@default(draft) add c4_
-  |
-  o  51:07aaa06da467@default(draft) add c3_
-  |
-  | o  50:e543e9e71376@default(draft) add b4_
-  | |
-  o |  49:9379d7237601@default(draft) add c2prime
-  | |
-  | o  48:2b5cbe59aeca@default(draft) add b3prime
-  | |
-  | o  47:aa4f5bf8925e@default(draft) add b1prime
-  | |
-  o |  42:4a34f6744d4b@default(draft) add c1second
-  |/
-  o  25:4c0bc042ef3b@default(draft) add j1
-  |
-
 Check that uncommit respects the allowunstable option
 With only createmarkers we can only uncommit on a head
-  $ hg up 456e647fbe11
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat >> $HGRCPATH <<EOF
   > [experimental]
   > evolution=createmarkers, allnewcommands
   > EOF
-  $ glog -r "25::"
-  @  52:456e647fbe11@default(draft) add c4_
-  |
-  o  51:07aaa06da467@default(draft) add c3_
-  |
-  | o  50:e543e9e71376@default(draft) add b4_
-  | |
-  o |  49:9379d7237601@default(draft) add c2prime
-  | |
-  | o  48:2b5cbe59aeca@default(draft) add b3prime
-  | |
-  | o  47:aa4f5bf8925e@default(draft) add b1prime
-  | |
-  o |  42:4a34f6744d4b@default(draft) add c1second
-  |/
-  o  25:4c0bc042ef3b@default(draft) add j1
-  |
-  $ hg up .^
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg up 4c0bc042ef3b^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg uncommit --all
   abort: cannot uncommit in the middle of a stack
   [255]
-  $ hg up 456e647fbe11
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg up 4c0bc042ef3b
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg uncommit --all
   new changeset is empty
   (use "hg prune ." to remove it)
-  $ hg up e543e9e71376 -C
-  3 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  $ glog -r "25::"
-  o  53:897e7966b9ef@default(draft) add c4_
+  $ glog -r "18::"
+  @  26:04b32348803e@default(draft) add j1
   |
-  o  51:07aaa06da467@default(draft) add c3_
-  |
-  | @  50:e543e9e71376@default(draft) add b4_
+  | o  23:c70048fd3350@default(draft) add j3
+  | |
+  | o  22:714e60ca57b7@default(draft) add j2
   | |
-  o |  49:9379d7237601@default(draft) add c2prime
-  | |
-  | o  48:2b5cbe59aeca@default(draft) add b3prime
+  | x  21:b430835af718@default(draft) add j1
+  |/
+  | o  20:db3d894869b0@default(draft) add gh
   | |
-  | o  47:aa4f5bf8925e@default(draft) add b1prime
-  | |
-  o |  42:4a34f6744d4b@default(draft) add c1second
+  o |  19:10ffdd7e3cc9@default(draft) add gg
   |/
-  o  25:4c0bc042ef3b@default(draft) add j1
+  o  18:0bb66d4c1968@default(draft) a3
   |