view tests/test-evolve-abort-phasediv.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 d00f0c369bc7
children 21eab0a99841
line wrap: on
line source

Tests for the --abort flag for `hg evolve` command while phase-divergence resolution
====================================================================================

The `--abort` flag aborts the interuppted evolve by undoing all the work which
was done during resolution i.e. stripping new changesets created, moving
bookmarks back, moving working directory back.

This test contains cases when `hg evolve` is doing phase-divergence resolution.

Setup
=====

  $ cat >> $HGRCPATH <<EOF
  > [phases]
  > publish = False
  > [alias]
  > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
  > [extensions]
  > EOF
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH

  $ hg init abortrepo
  $ cd abortrepo
  $ echo ".*\.orig" > .hgignore
  $ hg add .hgignore
  $ hg ci -m "added hgignore"
  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;

  $ hg glog
  @  4:c41c793e0ef1 added d
  |   () draft
  o  3:ca1b80f7960a added c
  |   () draft
  o  2:b1661037fa25 added b
  |   () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

Creating phase divergence, resolution of which will lead to conflicts
----------------------------------------------------------------------

  $ hg up .^^^
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
  $ hg grab -r .~-3
  grabbing 4:c41c793e0ef1 "added d"
  $ echo foobar > c
  $ hg add c
  $ hg amend

  $ hg glog --hidden
  @  7:ddba58020bc0 added d
  |   () draft
  | x  6:7490b254b0eb temporary amend commit for cfe30edc6125
  | |   () draft
  | x  5:cfe30edc6125 added d
  |/    () draft
  | x  4:c41c793e0ef1 added d
  | |   () draft
  | o  3:ca1b80f7960a added c
  | |   () draft
  | o  2:b1661037fa25 added b
  |/    () draft
  o  1:c7586e2a9264 added a
  |   () draft
  o  0:8fa14d15e168 added hgignore
      () draft

  $ hg phase -r c41c793e0ef1 --public --hidden
  1 new bumped changesets

  $ hg glog
  @  7:ddba58020bc0 added d
  |   () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public
  $ hg evolve --phase-divergent
  recreate:[7] added d
  atop:[4] added d
  rebasing to destination parent: ca1b80f7960a
  merging c
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
  fix conflicts and see `hg help evolve.interrupted`
  [1]

testing that interrupted evolve shows up in morestatus
  $ hg status -v
  M c
  A d

  $ hg evolve --abort
  evolve aborted
  working directory is now at ddba58020bc0

  $ hg glog
  @  7:ddba58020bc0 added d
  |   () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public

When there are multiple phase-divergent changes, resolution of last one resulted
in conflicts
---------------------------------------------------------------------------------

  $ echo foo > c
  $ hg amend
  $ hg phase -r ca1b80f --draft --force
  $ hg prev
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  [1] added a
  $ hg grab -r ca1b80f
  grabbing 3:ca1b80f7960a "added c"
  $ echo foobar > b
  $ hg add b
  $ hg amend
  $ hg phase -r c41c793e0ef1 --public --hidden
  2 new bumped changesets

  $ hg evolve --list
  e44ebefe4f54: added d
    bumped: c41c793e0ef1 (immutable precursor)
  
  28cd06b3f801: added c
    bumped: ca1b80f7960a (immutable precursor)
  

  $ hg evolve --dry-run --all --phase-divergent
  recreate:[9] added d
  atop:[4] added d
  hg rebase --rev e44ebefe4f54 --dest ca1b80f7960a;
  hg update c41c793e0ef1;
  hg revert --all --rev e44ebefe4f54;
  hg commit --msg "bumped update to e44ebefe4f54"
  recreate:[12] added c
  atop:[3] added c
  hg rebase --rev 28cd06b3f801 --dest b1661037fa25;
  hg update ca1b80f7960a;
  hg revert --all --rev 28cd06b3f801;
  hg commit --msg "bumped update to 28cd06b3f801"

  $ hg glog --hidden
  @  12:28cd06b3f801 added c
  |   () draft
  | x  11:df2e1e03f9b3 temporary amend commit for 9ff8adbe8a24
  | |   () draft
  | x  10:9ff8adbe8a24 added c
  |/    () draft
  | o  9:e44ebefe4f54 added d
  |/    () draft
  | x  8:e8e0a6683006 temporary amend commit for ddba58020bc0
  | |   () draft
  | x  7:ddba58020bc0 added d
  |/    () draft
  | x  6:7490b254b0eb temporary amend commit for cfe30edc6125
  | |   () draft
  | x  5:cfe30edc6125 added d
  |/    () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public

  $ hg evolve --phase-divergent --all
  recreate:[9] added d
  atop:[4] added d
  rebasing to destination parent: ca1b80f7960a
  computing new diff
  committed as c41c793e0ef1
  recreate:[12] added c
  atop:[3] added c
  rebasing to destination parent: b1661037fa25
  merging b
  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
  fix conflicts and see `hg help evolve.interrupted`
  [1]

  $ hg evolve --abort
  evolve aborted
  working directory is now at 28cd06b3f801

  $ hg glog --hidden
  @  12:28cd06b3f801 added c
  |   () draft
  | x  11:df2e1e03f9b3 temporary amend commit for 9ff8adbe8a24
  | |   () draft
  | x  10:9ff8adbe8a24 added c
  |/    () draft
  | o  9:e44ebefe4f54 added d
  |/    () draft
  | x  8:e8e0a6683006 temporary amend commit for ddba58020bc0
  | |   () draft
  | x  7:ddba58020bc0 added d
  |/    () draft
  | x  6:7490b254b0eb temporary amend commit for cfe30edc6125
  | |   () draft
  | x  5:cfe30edc6125 added d
  |/    () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public

When there are multiple conflicted phase-divergence resolution and we abort
after resolving one of them
----------------------------------------------------------------------------

  $ hg up e44ebefe4f54
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo foobar > c
  $ hg amend

  $ hg glog --hidden
  @  14:ef9b72b9b42c added d
  |   () draft
  | x  13:8d4b16b17719 temporary amend commit for e44ebefe4f54
  | |   () draft
  +---o  12:28cd06b3f801 added c
  | |     () draft
  | | x  11:df2e1e03f9b3 temporary amend commit for 9ff8adbe8a24
  | | |   () draft
  +---x  10:9ff8adbe8a24 added c
  | |     () draft
  | x  9:e44ebefe4f54 added d
  |/    () draft
  | x  8:e8e0a6683006 temporary amend commit for ddba58020bc0
  | |   () draft
  | x  7:ddba58020bc0 added d
  |/    () draft
  | x  6:7490b254b0eb temporary amend commit for cfe30edc6125
  | |   () draft
  | x  5:cfe30edc6125 added d
  |/    () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public

  $ hg evolve --phase-divergent --all
  recreate:[12] added c
  atop:[3] added c
  rebasing to destination parent: b1661037fa25
  merging b
  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
  fix conflicts and see `hg help evolve.interrupted`
  [1]

  $ echo watwat > c
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg evolve --continue
  evolving 12:28cd06b3f801 "added c"
  computing new diff
  committed as a71c993be085
  recreate:[14] added d
  atop:[4] added d
  rebasing to destination parent: ca1b80f7960a
  merging c
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
  fix conflicts and see `hg help evolve.interrupted`
  [1]

  $ hg evolve --abort
  evolve aborted
  working directory is now at ef9b72b9b42c

  $ hg glog --hidden
  @  14:ef9b72b9b42c added d
  |   () draft
  | x  13:8d4b16b17719 temporary amend commit for e44ebefe4f54
  | |   () draft
  +---o  12:28cd06b3f801 added c
  | |     () draft
  | | x  11:df2e1e03f9b3 temporary amend commit for 9ff8adbe8a24
  | | |   () draft
  +---x  10:9ff8adbe8a24 added c
  | |     () draft
  | x  9:e44ebefe4f54 added d
  |/    () draft
  | x  8:e8e0a6683006 temporary amend commit for ddba58020bc0
  | |   () draft
  | x  7:ddba58020bc0 added d
  |/    () draft
  | x  6:7490b254b0eb temporary amend commit for cfe30edc6125
  | |   () draft
  | x  5:cfe30edc6125 added d
  |/    () draft
  | o  4:c41c793e0ef1 added d
  | |   () public
  | o  3:ca1b80f7960a added c
  | |   () public
  | o  2:b1661037fa25 added b
  |/    () public
  o  1:c7586e2a9264 added a
  |   () public
  o  0:8fa14d15e168 added hgignore
      () public