tests/test-stabilize-result.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 23 Aug 2012 18:01:28 +0200
changeset 487 595ae87e94b6
parent 486 2111c655b4f5
child 491 6989d8fe4ed2
permissions -rw-r--r--
update changelog

  $ 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 unstable 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 unstable 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 latecomer 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
  

Stabilize of conflicting changeset with same parent
====================================================

  $ rm a.orig
  $ hg up 9
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ cat << EOF >> a
  > flore
  > arthur
  > zephir
  > some
  > less
  > conflict
  > EOF
  $ hg ci -m 'More addition'
  created new head
  $ glog
  @  15:7391601a4bfa@default(draft) bk:[] More addition
  |
  | o  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
  
  $ echo 'babar' >> a
  $ hg amend
  $ hg up 15
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  Working directory parent is obsolete
  $ mv a a.old
  $ echo 'jungle' > a
  $ cat a.old >> a
  $ rm a.old
  $ hg amend
  2 new conflicting changesets
  $ glog
  @  19:3883461cc228@default(draft) bk:[] More addition
  |
  | o  17:4754d61bc2db@default(draft) bk:[] More addition
  |/
  | o  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
  

Stabilize It

  $ hg stabilize -qn
  hg update -c 3883461cc228 &&
  hg merge 4754d61bc2db && 
  hg commit -m "auto merge resolving conflict between 3883461cc228 and 4754d61bc2db"&&
  hg up -C 7391601a4bfa &&
  hg revert --all --rev tip &&
  hg commit -m "`hg log -r 3883461cc228 --template={desc}`";
  $ hg stabilize -v
  merge:[19] More addition
  with: [17] More addition
  base: [15] More addition
  merging conflicting changeset
  resolving manifests
  merging a
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
  a
  a
  $ hg st
  $ hg amend -d '0 0' -m 'More addition' # kill date variation XXX should be done in stabilize
  $ glog
  @  22:ac6d600735a4@default(draft) bk:[] More addition
  |
  | o  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
  
  $ hg summary
  parent: 22:ac6d600735a4 tip
   More addition
  branch: default
  commit: (clean)
  update: 19 new changesets, 14 branch heads (merge)
  $ hg export .
  # HG changeset patch
  # User test
  # Date 0 0
  # Node ID ac6d600735a49ee377e29d1f74a0576e8c972e7b
  # Parent  355c5cda4de162658ed9f961a98a73a10b3167b1
  More addition
  
  diff -r 355c5cda4de1 -r ac6d600735a4 a
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,9 @@
  +jungle
   a
  +flore
  +arthur
  +zephir
  +some
  +less
  +conflict
  +babar