tests/test-stabilize-result.t
author Levi Bard <levi@unity3d.com>
Sat, 09 Feb 2013 18:07:36 +0100
changeset 707 f914e315b717
parent 625 e291e5271694
child 696 121e2d265e85
permissions -rw-r--r--
evolve: remove magic return values from utility functions

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

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

Test evolve removing the changeset being evolved

  $ 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 evolve -v
  move:[2] changea
  atop:[4] changea
  hg rebase -r 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 evolve 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 evolve
  move:[5] newer a
  atop:[7] changea
  merging a
  warning: conflicts during merge.
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
  evolve failed!
  fix conflict and run "hg evolve --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 evolve --continue
  grafting revision 5
  abort: unresolved merge conflicts (see hg help resolve)
  [255]
  $ hg resolve -m a
  $ hg evolve --continue
  grafting revision 5

Stabilize of late comer with different parent
==================================================

(the same parent case 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 --hidden --public 8
  1 new bumped 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 evolve --any --dry-run
  recreate:[12] newer a
  atop:[8] newer a
  hg rebase --rev 15c83af6f3a3 --dest e8cc1b534401;
  hg update e3183e9c0961;
  hg revert --all --rev 15c83af6f3a3;
  hg commit --msg "bumped update to %s" (no-eol)
  $ hg evolve --any
  recreate:[12] newer a
  atop:[8] newer a
  rebasing to destination parent: e8cc1b534401
  computing new diff
  commited as eeeb8f6e7648
  $ glog
  @  14:eeeb8f6e7648@default(draft) bk:[] bumped 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 conflicting changesets 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'
  $ glog
  @  15:7391601a4bfa@default(draft) bk:[] More addition
  |
  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped 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 --hidden 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 divergent changesets
  $ glog
  @  19:3883461cc228@default(draft) bk:[] More addition
  |
  | o  17:4754d61bc2db@default(draft) bk:[] More addition
  |/
  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped 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 evolve -qn --traceback
  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 evolve -v
  merge:[19] More addition
  with: [17] More addition
  base: [15] More addition
  merging divergent 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 evolve
  $ glog
  @  22:ac6d600735a4@default(draft) bk:[] More addition
  |
  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped 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: 2 new changesets, 2 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

Check conflicting during conflicting resolution
-------------------------------------------------

  $ hg up --hidden 15
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  Working directory parent is obsolete
  $ echo 'gotta break' >> a
  $ hg amend
  2 new divergent changesets
  $ hg phase 'divergent()'
  22: draft
  24: draft
  $ hg evolve -qn
  hg update -c c956a4b140b6 &&
  hg merge ac6d600735a4 &&
  hg commit -m "auto merge resolving conflict between c956a4b140b6 and ac6d600735a4"&&
  hg up -C 7391601a4bfa &&
  hg revert --all --rev tip &&
  hg commit -m "`hg log -r c956a4b140b6 --template={desc}`";
  $ hg evolve
  merge:[24] More addition
  with: [22] More addition
  base: [15] More addition
  merging a
  warning: conflicts during merge.
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
  abort: Merge conflict between several amendments, and this is not yet automated
  (/!\ You can try:
  /!\ * manual merge + resolve => new cset X
  /!\ * hg up to the parent of the amended changeset (which are named W and Z)
  /!\ * hg revert --all -r X
  /!\ * hg ci -m "same message as the amended changeset" => new cset Y
  /!\ * hg kill -n Y W Z
  )
  [255]