tests/test-stabilize-result.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 23 Aug 2012 12:23:00 +0200
changeset 478 13ccb68b728d
parent 469 abeb17a9e313
child 484 20e2f2dd71f1
permissions -rw-r--r--
update changelog for upcoming 1.0

  $ 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}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
  > }

Test stabilize removing the changeset being stabilized

  $ hg init empty
  $ cd empty
  $ echo a > a
  $ hg ci -Am adda a
  $ echo b > b
  $ hg ci -Am addb b
  $ echo a >> a
  $ hg ci -m changea
  $ hg bookmark changea
  $ hg up 1
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a >> a
  $ hg amend -m changea
  1 new unstables changesets
  $ hg stabilize -v
  move:[2] changea
  atop:[4] changea
  hg rebase -Dr cce2c55b8965 -d 1447e1c4828d
  resolving manifests
  $ glog --hidden
  @  4:1447e1c4828d@default(draft) bk:[changea] changea
  |
  | x  3:41ad4fe8c795@default(draft) bk:[] amends 102a90ea7b4a3361e4082ed620918c261189a36a
  | |
  | | x  2:cce2c55b8965@default(draft) bk:[] changea
  | |/
  | x  1:102a90ea7b4a@default(draft) bk:[] addb
  |/
  o  0:07f494440405@default(draft) bk:[] adda
  
  $ hg debugobsolete
  41ad4fe8c79565a06c89f032ef0937b3cbd68a04 1447e1c4828d2347df8f858aa041305fa4cf7db1 0 {'date': '* *', 'user': 'test'} (glob)
  102a90ea7b4a3361e4082ed620918c261189a36a 1447e1c4828d2347df8f858aa041305fa4cf7db1 0 {'date': '* *', 'user': 'test'} (glob)
  cce2c55b896511e0b6e04173c9450ba822ebc740 0 {'date': '* *', 'user': 'test'} (glob)

Test stabilize with conflict

  $ ls
  a
  b
  $ hg pdiff a
  diff -r 07f494440405 a
  --- a/a	* (glob)
  +++ b/a	* (glob)
  @@ -1,1 +1,2 @@
   a
  +a
  $ echo 'newer a' >> a
  $ hg ci -m 'newer a'
  $ hg gdown
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  [4] changea
  $ echo 'a' > a
  $ hg amend
  1 new unstables changesets
  $ hg stabilize
  move:[5] newer a
  atop:[7] changea
  merging a
  warning: conflicts during merge.
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
  stabilize failed!
  fix conflict and run "hg stabilize --continue"
  abort: unresolved merge conflicts (see hg help resolve)
  [255]
  $ hg revert -r 'unstable()' a
  $ hg diff
  diff -r e8cc1b534401 a
  --- a/a	* (glob)
  +++ b/a	* (glob)
  @@ -1,1 +1,3 @@
   a
  +a
  +newer a
  $ hg stabilize --continue
  grafting revision 5
  abort: unresolved merge conflicts (see hg help resolve)
  [255]
  $ hg resolve -m a
  $ hg stabilize --continue
  grafting revision 5

Stabilize of late comer with different parent
==================================================
(the with same parent is handled in test-evolve.t)

  $ glog
  @  8:e3183e9c0961@default(draft) bk:[] newer a
  |
  o  7:e8cc1b534401@default(draft) bk:[changea] changea
  |
  o  0:07f494440405@default(draft) bk:[] adda
  
Add another commit

  $ hg gdown
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  [7] changea
  $ echo 'c' > c
  $ hg add c
  $ hg commit -m 'add c'
  created new head

Get a successors of 8 on it

  $ hg graft -O 8
  grafting revision 8

Add real change to the successors

  $ echo 'babar' >> a
  $ hg amend

Make precursors public

  $ hg phase --public 8
  1 new latecomers changesets
  $ glog
  @  12:15c83af6f3a3@default(draft) bk:[] newer a
  |
  o  9:355c5cda4de1@default(draft) bk:[] add c
  |
  | o  8:e3183e9c0961@default(public) bk:[] newer a
  |/
  o  7:e8cc1b534401@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  

Stabilize !

  $ hg stabilize --any --dry-run
  recreate:[12] newer a
  atop:[8] newer a
  hg rebase --rev 15c83af6f3a3 --detach e8cc1b534401;
  hg update e3183e9c0961;
  hg revert --all --rev 15c83af6f3a3;
  hg commit --msg "latecomer update to %s" (no-eol)
  $ hg stabilize --any
  recreate:[12] newer a
  atop:[8] newer a
  rebasing to destination parent: e8cc1b534401
  computing new diff
  commited as 1d94fef80e85
  $ glog
  @  14:1d94fef80e85@default(draft) bk:[] latecomer update to e3183e9c0961:
  |
  | o  9:355c5cda4de1@default(draft) bk:[] add c
  | |
  o |  8:e3183e9c0961@default(public) bk:[] newer a
  |/
  o  7:e8cc1b534401@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda