tests/test-evolve-issue5966.t
author Anton Shestakov <av6@dwimlabs.net>
Sat, 06 Apr 2019 15:49:22 +0200
changeset 4477 faf99d48eda9
parent 4311 8aa28e68ac44
child 4315 55ca0b6276e7
child 4577 bcd52ce0916d
permissions -rw-r--r--
stack: fix phasecache._phasesets check logic When _phasesets is not None, it's a list, and it contains set()s of revisions in a specific phase, starting from public, draft, secret and so on. But since repos are supposed to have the majority of revisions in public phase, the first element of this list is not a (potentially huge) set, but None. Previously this code tried to check if there's any element that is None, and was always finding None at index 0, so the short path was executed every time and the rest of the function was never used.

Testing evolve --continue with unresolved conflicts (issue5966)
https://bz.mercurial-scm.org/show_bug.cgi?id=5966

  $ . $TESTDIR/testlib/common.sh

  $ hg init issue5966
  $ cd issue5966
  $ cat > .hg/hgrc << EOF
  > [phases]
  > publish = false
  > [alias]
  > glog = log -GT "{rev}: {desc}"
  > [extensions]
  > evolve=
  > EOF

  $ touch a
  $ hg ci -Aqm 'empty'

  $ echo apple > a
  $ hg ci -m 'apple'
  $ echo banana > a
  $ hg ci -m 'banana'
  $ echo coconut > a
  $ hg ci -m 'coconut'

  $ hg glog
  @  3: coconut
  |
  o  2: banana
  |
  o  1: apple
  |
  o  0: empty
  

  $ hg up -q 1

Amending revision 1 in a way that causes conflicts

  $ echo apricot > a
  $ hg amend -m 'apricot'
  2 new orphan changesets

  $ hg glog --hidden
  @  4: apricot
  |
  | *  3: coconut
  | |
  | *  2: banana
  | |
  | x  1: apple
  |/
  o  0: empty
  

  $ hg evolve -t :fail
  move:[2] banana
  atop:[4] apricot
  fix conflicts and see `hg help evolve.interrupted`
  [1]
  $ hg evolve --list
  34a690fcf6ab: banana
    orphan: 7f59f18ca4a9 (obsolete parent)
  
  feb8c0bffa1f: coconut
    orphan: 34a690fcf6ab (orphan parent)
  
Evolve should detect unresolved conflict.

  $ hg resolve --list
  U a
  $ hg evolve --continue
  abort: unresolved merge conflicts (see 'hg help resolve')
  [255]

(even when ran twice)

  $ hg evolve --continue
  abort: unresolved merge conflicts (see 'hg help resolve')
  [255]

  $ cat a
  apricot
  $ hg resolve --list
  U a
  $ hg resolve a -t :other
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg resolve --list
  R a
  $ hg evolve --continue
  evolving 2:34a690fcf6ab "banana"
  working directory is now at e4207a610ed0
  $ hg resolve --list

evolve the rest of the stack

  $ hg evolve
  move:[3] coconut
  atop:[5] banana
  merging a
  working directory is now at d77b4639fe26

All commit evolved

  $ hg glog
  @  6: coconut
  |
  o  5: banana
  |
  o  4: apricot
  |
  o  0: empty