view tests/test-stabilize-result.t @ 3936:537fd9a86c06 mercurial-4.3

test-compat: merge mercurial-4.4 into mercurial-4.3
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 03 Aug 2018 00:22:50 +0200
parents e5ba6531503e d00f0c369bc7
children 9c025ec4af88
line wrap: on
line source

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

  $ glog() {
  >   hg log -G --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
  (leaving bookmark changea)
  $ echo a >> a
  $ hg amend -m changea
  1 new unstable changesets
  $ hg evolve -v --confirm
  move:[2] changea
  atop:[4] changea
  perform evolve? [Ny] n
  abort: evolve aborted by user
  [255]
  $ echo y | hg evolve -v --confirm --config ui.interactive=True
  move:[2] changea
  atop:[4] changea
  perform evolve? [Ny] y
  hg rebase -r cce2c55b8965 -d fb9d051ec0a4
  resolving manifests
  evolution of 2:cce2c55b8965 created no changes to commit

  $ glog --hidden
  @  4:fb9d051ec0a4@default(draft) bk:[changea] changea
  |
  | x  3:c5727dbded3c@default(draft) bk:[] temporary amend commit for 102a90ea7b4a
  | |
  | | x  2:cce2c55b8965@default(draft) bk:[] changea
  | |/
  | x  1:102a90ea7b4a@default(draft) bk:[] addb
  |/
  o  0:07f494440405@default(draft) bk:[] adda
  
  $ hg debugobsolete
  102a90ea7b4a3361e4082ed620918c261189a36a fb9d051ec0a450a4aa2ffc8c324979832ef88065 0 (*) {'ef1': '*', 'user': 'test'} (glob)
  c5727dbded3c3a6877cf60d6bb552a76812cb844 0 {102a90ea7b4a3361e4082ed620918c261189a36a} (*) {'ef1': '*', 'user': 'test'} (glob)
  cce2c55b896511e0b6e04173c9450ba822ebc740 0 {102a90ea7b4a3361e4082ed620918c261189a36a} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}

Test evolve with conflict

  $ ls
  a
  b
  $ hg pdiff a
  diff -r 07f494440405 a
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,2 @@
   a
  +a
  $ echo 'newer a' >> a
  $ hg ci -m 'newer a'
  $ hg gdown
  gdown have been deprecated in favor of previous
  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 while merging a! (edit, then use 'hg resolve --mark')
  fix conflicts and see `hg help evolve.interrupted`
  [1]
  $ hg revert -r "orphan()" a
  $ hg diff
  diff -r 66719795a494 a
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,3 @@
   a
  +a
  +newer a
  $ hg evolve --continue
  evolving 5:3655f0f50885 "newer a"
  abort: unresolved merge conflicts (see 'hg help resolve')
  [255]
  $ hg resolve -m a
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg evolve --continue
  evolving 5:3655f0f50885 "newer a"
  working directory is now at 1cf0aacfd363

Stabilize latecomer with different parent
=========================================

(the same-parent case is handled in test-evolve.t)

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

  $ hg gdown
  gdown have been deprecated in favor of previous
  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 grab 1cf0aacfd363
  grabbing 8:1cf0aacfd363 "newer a"

Add real change to the successors

  $ echo 'babar' >> a
  $ hg amend

Make precursors public

  $ hg phase --hidden --public 1cf0aacfd363
  1 new bumped changesets
  $ glog
  @  12:99c21c89bcef@default(draft) bk:[] newer a
  |
  o  9:7bc2f5967f5e@default(draft) bk:[] add c
  |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  

Stabilize!

  $ hg evolve --any --dry-run --phase-divergent
  recreate:[12] newer a
  atop:[8] newer a
  hg rebase --rev 99c21c89bcef --dest 66719795a494;
  hg update 1cf0aacfd363;
  hg revert --all --rev 99c21c89bcef;
  hg commit --msg "bumped update to 99c21c89bcef"
  $ hg evolve --any --confirm --phase-divergent
  recreate:[12] newer a
  atop:[8] newer a
  perform evolve? [Ny] n
  abort: evolve aborted by user
  [255]
  $ echo y | hg evolve --any --confirm --config ui.interactive=True --phase-divergent
  recreate:[12] newer a
  atop:[8] newer a
  perform evolve? [Ny] y
  rebasing to destination parent: 66719795a494
  computing new diff
  committed as cd735a3aeb32
  working directory is now at cd735a3aeb32
  $ glog
  @  14:cd735a3aeb32@default(draft) bk:[] bumped update to 1cf0aacfd363:
  |
  | o  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  o |  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  
  $ hg exp
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Node ID cd735a3aeb32e80b92f780c4ace1650597d581b2
  # Parent  1cf0aacfd36310b18e403e1594871187e0364a82
  bumped update to 1cf0aacfd363:
  
  newer a
  
  diff -r 1cf0aacfd363 -r cd735a3aeb32 a
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,3 +1,4 @@
   a
   a
   newer a
  +babar

Stabilize divergent changesets with same parent
===============================================

  $ rm a.orig
  $ hg up 7bc2f5967f5e
  2 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:3932c176bbaa@default(draft) bk:[] More addition
  |
  | o  14:(a7cabd7bd9c2|671b9d7eeaec)@default\(draft\) bk:\[\] bumped update to 1cf0aacfd363: (re)
  | |
  o |  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  
  $ echo 'babar' >> a
  $ hg amend
  $ hg up --hidden 3932c176bbaa
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  working directory parent is obsolete! (3932c176bbaa)
  (use 'hg evolve' to update to its successor: d2f173e25686)
  $ mv a a.old
  $ echo 'jungle' > a
  $ cat a.old >> a
  $ rm a.old
  $ hg amend
  2 new divergent changesets
  $ glog
  @  19:eacc9c8240fe@default(draft) bk:[] More addition
  |
  | o  17:d2f173e25686@default(draft) bk:[] More addition
  |/
  | o  14:(a7cabd7bd9c2|671b9d7eeaec)@default\(draft\) bk:\[\] bumped update to 1cf0aacfd363: (re)
  | |
  o |  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  

Stabilize it

  $ hg evolve -qn --confirm --content-divergent
  merge:[19] More addition
  with: [17] More addition
  base: [15] More addition
  perform evolve? [Ny] n
  abort: evolve aborted by user
  [255]
  $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
  merge:[19] More addition
  with: [17] More addition
  base: [15] More addition
  perform evolve? [Ny] y
  hg update -c eacc9c8240fe &&
  hg merge d2f173e25686 &&
  hg commit -m "auto merge resolving conflict between eacc9c8240fe and d2f173e25686"&&
  hg up -C 3932c176bbaa &&
  hg revert --all --rev tip &&
  hg commit -m "`hg log -r eacc9c8240fe --template={desc}`";
  $ hg evolve -v --content-divergent
  merge:[19] More addition
  with: [17] More addition
  base: [15] More addition
  merging "other" divergent changeset 'd2f173e25686'
  resolving manifests
  merging a
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
  committing files:
  a
  committing manifest
  committing changelog
  working directory is now at 4d6ed26797bc
  $ hg st
  $ glog
  | o  14:(a7cabd7bd9c2|671b9d7eeaec)@default\(draft\) bk:\[\] bumped update to 1cf0aacfd363: (re)
  |
  | o  14:cd735a3aeb32@default(draft) bk:[] bumped update to 1cf0aacfd363:
  | |
  o |  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  
  $ hg summary
  parent: 20:4d6ed26797bc tip
   More addition
  branch: default
  commit: (clean)
  update: 2 new changesets, 2 branch heads (merge)
  phases: 3 draft
  $ hg export .
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
  # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
  More addition
  
  diff -r 7bc2f5967f5e -r 4d6ed26797bc 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 conflict during divergence resolution
-------------------------------------------------

  $ hg up --hidden 3932c176bbaa
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  working directory parent is obsolete! (3932c176bbaa)
  (use 'hg evolve' to update to its successor: 4d6ed26797bc)
  $ echo 'gotta break' >> a
  $ hg amend
  2 new divergent changesets
# reamend so that the case is not the first precursor.
  $ hg amend -m "More addition (2)"
  $ hg phase 'contentdivergent()'
  20: draft
  23: draft

  $ glog
  @  23:0b336205a5d0@default(draft) bk:[] More addition (2)
  |
  | o  20:4d6ed26797bc@default(draft) bk:[] More addition
  |/
  | o  14:cd735a3aeb32@default(draft) bk:[] bumped update to 1cf0aacfd363:
  | |
  o |  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  

  $ hg evolve -qn --content-divergent
  hg update -c 0b336205a5d0 &&
  hg merge 4d6ed26797bc &&
  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
  hg up -C 3932c176bbaa &&
  hg revert --all --rev tip &&
  hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
  $ hg evolve --content-divergent
  merge:[23] More addition (2)
  with: [20] More addition
  base: [15] More addition
  merging "other" divergent changeset '4d6ed26797bc'
  merging a
  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  fix conflicts and see `hg help evolve.interrupted`
  [1]

  $ cat > a <<EOF
  > jungle
  > a
  > flore
  > arthur
  > zephir
  > some
  > less
  > conflict
  > babar
  > EOF

  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg evolve --continue
  working directory is now at e8746835a2a1
  $ glog
  @  24:e8746835a2a1@default(draft) bk:[] More addition (2)
  |
  | o  14:cd735a3aeb32@default(draft) bk:[] bumped update to 1cf0aacfd363:
  | |
  o |  9:7bc2f5967f5e@default(draft) bk:[] add c
  | |
  | o  8:1cf0aacfd363@default(public) bk:[] newer a
  |/
  o  7:66719795a494@default(public) bk:[changea] changea
  |
  o  0:07f494440405@default(public) bk:[] adda
  
  $ hg exp
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
  # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
  More addition (2)
  
  diff -r 7bc2f5967f5e -r e8746835a2a1 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