tests/test-evolve-orphan-switched-ancestors.t
author Manuel Jacob <me@manueljacob.de>
Sat, 21 Mar 2020 20:36:41 +0100
changeset 5314 f12d2172a133
permissions -rw-r--r--
evolve: consider all obsolete ancestors when finding new parent for orphan Both the old and the new logic have in common that the orphan changeset is moved to the tipmost successor of one or more ancestors of the orphan changeset. The previous logic considered only the first non-pruned ancestor of the orphan changeset. The new logic considers all obsolete ancestors of the orphan changeset. The logic in _possibledestination() had to be changed to be consistent with the new logic.

  $ . $TESTDIR/testlib/common.sh
  $ cat >> $HGRCPATH <<EOF
  > [extensions]
  > evolve=
  > [alias]
  > glog = log -GT "{rev}:{node|short} {desc}\n"
  > EOF

Test that, even if the order of the ancestors has been switched, the orphan is
rebased such that it has the sucessors of both original ancestors are the new
ancestors.

  $ hg init repo
  $ cd repo
  $ mkcommit a
  $ mkcommit b
  $ echo a1 > a; echo b1 > b; hg ci -m 'mod ab'
  $ hg up null -q
  $ hg pick 1
  picking 1:d2ae7f538514 "b"
  1 new orphan changesets
  $ hg pick 0
  picking 0:cb9a9f314b8b "a"
  $ hg next --dry-run
  move:[2] mod ab
  atop:[4] a
  hg rebase -r cc6607605d1e -d f4a8092719b1
  $ hg evolve
  move:[2] mod ab
  atop:[4] a
  $ hg glog
  o  5:866738c73814 mod ab
  |
  @  4:f4a8092719b1 a
  |
  o  3:6563da9dcf87 b