tests/test-evolve-issue5966.t
author Sushil khanchi <sushilkhanchi97@gmail.com>
Sat, 23 Nov 2019 16:17:04 +0530
branchstable
changeset 4991 2928f35023a1
parent 4676 b6c819facbe8
permissions -rw-r--r--
evolve: make sure divergence resolution doesn't undo changes (issue6203) Before this patch, in content-divergence resolution logic if resolution parent is not the parent of any of the two divergent changesets then it could undo some changes introduced by previous revs (while resolving stack of content-divergent changesets) as demonstrated by the test added in previous patch. To solve this, what this patch doing is: if divergent cset has obsolete parent with a successor then first resolve the "orphan" instability of divergent cset by relocating, then perform the content-divergence resolution. After this change in logic, I found that it's kind of more correct as reflected by the changes in tests/test-evolve-content-divergent-corner-cases.t where it prevented creating conflicts while merging. Changes in tests/test-evolve-content-divergent-stack.t demonstrate the fixed behaviour. Next patches will be covering the `evolve --continue` case for the relocation of "divergent" cset.

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 --rev 'first(orphan())'
  move:[2] banana
  atop:[4] apricot
  unresolved merge conflicts
  (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 581a2bb4704c
  $ hg resolve --list

evolve the rest of the stack

  $ hg evolve
  move:[3] coconut
  atop:[5] banana
  merging a

All commit evolved

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