tests/test-stabilize-order.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 31 Jul 2012 12:47:56 +0200
changeset 407 9fcbe7c47939
parent 346 f4302a2079f4
child 441 d702f0d26c6a
permissions -rw-r--r--
merge with stable

  $ cat >> $HGRCPATH <<EOF
  > [defaults]
  > amend=-d "0 0"
  > [extensions]
  > hgext.rebase=
  > hgext.graphlog=
  > EOF
  $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH

  $ glog() {
  >   hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
  > }

  $ hg init repo
  $ cd repo
  $ echo root > root
  $ hg ci -Am addroot
  adding root
  $ echo a > a
  $ hg ci -Am adda
  adding a
  $ echo b > b
  $ hg ci -Am addb
  adding b
  $ echo c > c
  $ hg ci -Am addc
  adding c
  $ glog
  @  3:7a7552255fb5@default(draft) addc
  |
  o  2:ef23d6ef94d6@default(draft) addb
  |
  o  1:93418d2c0979@default(draft) adda
  |
  o  0:c471ef929e6a@default(draft) addroot
  
  $ hg gdown
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  [2] addb
  $ echo b >> b
  $ hg amend
  1 new unstables changesets
  $ hg gdown
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  [1] adda
  $ echo a >> a
  $ hg amend
  1 new unstables changesets
  $ glog
  @  7:f5ff10856e5a@default(draft) adda
  |
  | o  5:ab8cbb6d87ff@default(draft) addb
  | |
  | | o  3:7a7552255fb5@default(draft) addc
  | | |
  | | x  2:ef23d6ef94d6@default(draft) addb
  | |/
  | x  1:93418d2c0979@default(draft) adda
  |/
  o  0:c471ef929e6a@default(draft) addroot
  

Test stabilizing a predecessor child

  $ hg stabilize -v
  move:[5] addb
  atop:[7] adda
  hg rebase -Dr ab8cbb6d87ff -d f5ff10856e5a
  resolving manifests
  getting b
  b
  $ glog
  @  8:6bf44048e43f@default(draft) addb
  |
  o  7:f5ff10856e5a@default(draft) adda
  |
  | o  3:7a7552255fb5@default(draft) addc
  | |
  | x  2:ef23d6ef94d6@default(draft) addb
  | |
  | x  1:93418d2c0979@default(draft) adda
  |/
  o  0:c471ef929e6a@default(draft) addroot
  

Test stabilizing a descendant predecessors child

  $ hg up 7
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg debugsuccessors > successors.old
  $ hg stabilize -v
  move:[3] addc
  atop:[8] addb
  hg rebase -Dr 7a7552255fb5 -d 6bf44048e43f
  resolving manifests
  getting b
  resolving manifests
  getting c
  c
  $ hg debugsuccessors > successors.new
  $ diff -u successors.old successors.new
  --- successors.old* (glob)
  +++ successors.new* (glob)
  @@ -1,5 +1,6 @@
   3a4a591493f8 f5ff10856e5a
   3ca0ded0dc50 ab8cbb6d87ff
  +7a7552255fb5 5e819fbb0d27
   93418d2c0979 f5ff10856e5a
   ab8cbb6d87ff 6bf44048e43f
   ef23d6ef94d6 ab8cbb6d87ff
  [1]
  $ glog
  @  9:5e819fbb0d27@default(draft) addc
  |
  o  8:6bf44048e43f@default(draft) addb
  |
  o  7:f5ff10856e5a@default(draft) adda
  |
  o  0:c471ef929e6a@default(draft) addroot
  
  $ hg stabilize -v
  no unstable changeset
  [1]

Test behaviour with --any

  $ hg up 8
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo b >> b
  $ hg amend
  1 new unstables changesets
  $ glog
  @  11:4e7cec6b4afe@default(draft) addb
  |
  | o  9:5e819fbb0d27@default(draft) addc
  | |
  | x  8:6bf44048e43f@default(draft) addb
  |/
  o  7:f5ff10856e5a@default(draft) adda
  |
  o  0:c471ef929e6a@default(draft) addroot
  
  $ hg up 9
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg stabilize -v
  nothing to stabilize here
  (1 unstable changesets, do you want --any ?)
  [2]
  $ hg stabilize --any -v
  move:[9] addc
  atop:[11] addb
  hg rebase -Dr 5e819fbb0d27 -d 4e7cec6b4afe
  resolving manifests
  removing c
  getting b
  resolving manifests
  getting c
  c
  $ glog
  @  12:24f95816bb21@default(draft) addc
  |
  o  11:4e7cec6b4afe@default(draft) addb
  |
  o  7:f5ff10856e5a@default(draft) adda
  |
  o  0:c471ef929e6a@default(draft) addroot
  
  $ hg stabilize --any -v
  no unstable changeset
  [1]