view tests/test-evolve-content-divergent-relocation.t @ 5294:265e029785ae

tests: show crash from divergence resolution resulting in empty commit When relocating a commit results in an empty commit (because the changes are already in the destination), we get a TypeError from evolve.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 09 Dec 2019 10:05:24 -0800
parents 13376ca93fa3
children ebfd0d875600
line wrap: on
line source

======================================================
Tests the resolution of content divergence: relocation
======================================================

This file intend to cover case where changesets need to be moved to different parents

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


Testing resolution of content-divergent changesets when they are on different
parents and resolution and relocation wont result in conflicts
------------------------------------------------------------------------------

  $ hg init multiparents
  $ cd multiparents
  $ 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
  |   () [default] draft
  o  3:ca1b80f7960a added c
  |   () [default] draft
  o  2:b1661037fa25 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg up .^^
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ echo bar > b
  $ hg amend
  2 new orphan changesets

  $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True
  rebasing 2:b1661037fa25 "added b"
  2 new content-divergent changesets

  $ hg glog
  *  6:da4b96f4a8d6 added b
  |   () [default] draft
  | @  5:7ed0642d644b added b
  | |   () [default] draft
  | | *  4:c41c793e0ef1 added d
  | | |   () [default] draft
  | | *  3:ca1b80f7960a added c
  | | |   () [default] draft
  | | x  2:b1661037fa25 added b
  | |/    () [default] draft
  | o  1:c7586e2a9264 added a
  |/    () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg evolve --content-divergent
  merge:[5] added b
  with: [6] added b
  base: [2] added b
  rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  working directory is now at f8f130ec5d39

  $ hg glog
  @  8:f8f130ec5d39 added b
  |   () [default] draft
  | *  4:c41c793e0ef1 added d
  | |   () [default] draft
  | *  3:ca1b80f7960a added c
  | |   () [default] draft
  | x  2:b1661037fa25 added b
  |/    () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg exp
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Node ID f8f130ec5d399699738abf984a885baa4fa9f06c
  # Parent  c7586e2a92645e473645847a7b69a6dc52be4276
  added b
  
  diff -r c7586e2a9264 -r f8f130ec5d39 b
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
  @@ -0,0 +1,1 @@
  +bar

  $ hg debugobsolete
  b1661037fa25511d0b7ccddf405e336f9d7d3424 7ed0642d644bb9ad93d252dd9ffe7b4729febe48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  b1661037fa25511d0b7ccddf405e336f9d7d3424 da4b96f4a8d610a85b225583138f681d67e275dd 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  da4b96f4a8d610a85b225583138f681d67e275dd 11f849d7159fa30a63dbbc1a6d251a8d996baeb5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  7ed0642d644bb9ad93d252dd9ffe7b4729febe48 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  11f849d7159fa30a63dbbc1a6d251a8d996baeb5 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  $ hg obslog --all
  @    f8f130ec5d39 (8) added b
  |\
  x |  11f849d7159f (7) added b
  | |    rewritten(meta, content) as f8f130ec5d39 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  7ed0642d644b (5) added b
  | |    meta-changed(meta) as f8f130ec5d39 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  x |  da4b96f4a8d6 (6) added b
  |/     rebased(parent) as 11f849d7159f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  |
  x  b1661037fa25 (2) added b
       amended(content) as 7ed0642d644b using amend by test (Thu Jan 01 00:00:00 1970 +0000)
       rebased(parent) as da4b96f4a8d6 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
  

Resolving orphans to get back to a normal graph

  $ hg evolve --all
  move:[3] added c
  atop:[8] added b
  move:[4] added d
  $ hg glog
  o  10:d34e10c64365 added d
  |   () [default] draft
  o  9:65f70b47129d added c
  |   () [default] draft
  @  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

More testing!

  $ echo x > x
  $ hg ci -Aqm "added x"
  $ hg glog -r .
  @  11:19fde4a13e16 added x
  |   () [default] draft
  ~

  $ echo foo > x
  $ hg branch bar
  marked working directory as branch bar
  (branches are permanent and global, did you want a bookmark?)
  $ hg amend -m "added foo to x"

  $ hg up 'predecessors(.)' --hidden
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  updated to hidden changeset 19fde4a13e16
  (hidden revision '19fde4a13e16' was rewritten as: 271db13e4ad1)
  working directory parent is obsolete! (19fde4a13e16)
  (use 'hg evolve' to update to its successor: 271db13e4ad1)
  $ hg rebase -r . -d 'desc("added d")' --config experimental.evolution.allowdivergence=True
  rebasing 11:19fde4a13e16 "added x"
  2 new content-divergent changesets

  $ hg glog
  @  13:eb9a1b31b6d8 added x
  |   () [default] draft
  | *  12:271db13e4ad1 added foo to x
  | |   () [bar] draft
  o |  10:d34e10c64365 added d
  | |   () [default] draft
  o |  9:65f70b47129d added c
  |/    () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg evolve --content-divergent
  merge:[13] added x
  with: [12] added foo to x
  base: [11] added x
  rebasing "other" content-divergent changeset 271db13e4ad1 on d34e10c64365
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  working directory is now at 806f7694feb1

  $ hg exp
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Branch bar
  # Node ID 806f7694feb1c58fdd7bf656445f3bd5463a008e
  # Parent  d34e10c643651d577eef840b427b58d9bd6ae3f0
  added foo to x
  
  diff -r d34e10c64365 -r 806f7694feb1 x
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
  @@ -0,0 +1,1 @@
  +foo

The above `hg exp` and the following log call demonstrates that message, content
and branch change is preserved in case of relocation
  $ hg glog
  @  15:806f7694feb1 added foo to x
  |   () [bar] draft
  o  10:d34e10c64365 added d
  |   () [default] draft
  o  9:65f70b47129d added c
  |   () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg debugobsolete
  b1661037fa25511d0b7ccddf405e336f9d7d3424 7ed0642d644bb9ad93d252dd9ffe7b4729febe48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  b1661037fa25511d0b7ccddf405e336f9d7d3424 da4b96f4a8d610a85b225583138f681d67e275dd 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  da4b96f4a8d610a85b225583138f681d67e275dd 11f849d7159fa30a63dbbc1a6d251a8d996baeb5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  7ed0642d644bb9ad93d252dd9ffe7b4729febe48 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  11f849d7159fa30a63dbbc1a6d251a8d996baeb5 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  ca1b80f7960aae2306287bab52b4090c59af8c29 65f70b47129d8466acbdc70bfb1efef3d05388e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  c41c793e0ef1ddb463e85ea9491e377d01127ba2 d34e10c643651d577eef840b427b58d9bd6ae3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 271db13e4ad11d4ca78b12e74e7341cb74c05a85 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '73', 'operation': 'amend', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 eb9a1b31b6d812c036ca547aca2931edde6d1e06 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  271db13e4ad11d4ca78b12e74e7341cb74c05a85 16810a5772dd9a27f4c0302d4e41009a2518588c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  eb9a1b31b6d812c036ca547aca2931edde6d1e06 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '75', 'operation': 'evolve', 'user': 'test'}
  16810a5772dd9a27f4c0302d4e41009a2518588c 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  $ hg obslog --all
  @    806f7694feb1 (15) added foo to x
  |\
  x |  16810a5772dd (14) added foo to x
  | |    meta-changed(meta) as 806f7694feb1 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  eb9a1b31b6d8 (13) added x
  | |    rewritten(description, meta, branch, content) as 806f7694feb1 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  x |  271db13e4ad1 (12) added foo to x
  |/     rebased(parent) as 16810a5772dd using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  |
  x  19fde4a13e16 (11) added x
       rewritten(description, branch, content) as 271db13e4ad1 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
       rebased(parent) as eb9a1b31b6d8 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
  

Testing when both the content-divergence are on different parents and resolution
will lead to conflicts
---------------------------------------------------------------------------------

  $ hg up .^^^
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved

  $ echo y > y
  $ hg ci -Aqm "added y"
  $ hg glog -r .
  @  16:6a167ad77c24 added y
  |   () [default] draft
  ~

  $ echo bar > y
  $ hg amend

  $ hg up 'predecessors(.)' --hidden
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  updated to hidden changeset 6a167ad77c24
  (hidden revision '6a167ad77c24' was rewritten as: 856e7b6a8392)
  working directory parent is obsolete! (6a167ad77c24)
  (use 'hg evolve' to update to its successor: 856e7b6a8392)
  $ hg rebase -r . -d 'desc("added foo to x")' --config experimental.evolution.allowdivergence=True
  rebasing 16:6a167ad77c24 "added y"
  2 new content-divergent changesets
  $ echo wat > y
  $ hg amend

  $ hg glog
  @  19:750fd38fec35 added y
  |   () [bar] draft
  | *  17:856e7b6a8392 added y
  | |   () [default] draft
  o |  15:806f7694feb1 added foo to x
  | |   () [bar] draft
  o |  10:d34e10c64365 added d
  | |   () [default] draft
  o |  9:65f70b47129d added c
  |/    () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg evolve --content-divergent
  merge:[19] added y
  with: [17] added y
  base: [16] added y
  rebasing "other" content-divergent changeset 856e7b6a8392 on 806f7694feb1
  merging y
  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  unresolved merge conflicts
  (see 'hg help evolve.interrupted')
  [1]

  $ echo watbar > y
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg evolve --continue
  working directory is now at 68ce3ad10d10

  $ hg glog
  @  21:68ce3ad10d10 added y
  |   () [bar] draft
  o  15:806f7694feb1 added foo to x
  |   () [bar] draft
  o  10:d34e10c64365 added d
  |   () [default] draft
  o  9:65f70b47129d added c
  |   () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg debugobsolete
  b1661037fa25511d0b7ccddf405e336f9d7d3424 7ed0642d644bb9ad93d252dd9ffe7b4729febe48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  b1661037fa25511d0b7ccddf405e336f9d7d3424 da4b96f4a8d610a85b225583138f681d67e275dd 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  da4b96f4a8d610a85b225583138f681d67e275dd 11f849d7159fa30a63dbbc1a6d251a8d996baeb5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  7ed0642d644bb9ad93d252dd9ffe7b4729febe48 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  11f849d7159fa30a63dbbc1a6d251a8d996baeb5 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  ca1b80f7960aae2306287bab52b4090c59af8c29 65f70b47129d8466acbdc70bfb1efef3d05388e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  c41c793e0ef1ddb463e85ea9491e377d01127ba2 d34e10c643651d577eef840b427b58d9bd6ae3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 271db13e4ad11d4ca78b12e74e7341cb74c05a85 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '73', 'operation': 'amend', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 eb9a1b31b6d812c036ca547aca2931edde6d1e06 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  271db13e4ad11d4ca78b12e74e7341cb74c05a85 16810a5772dd9a27f4c0302d4e41009a2518588c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  eb9a1b31b6d812c036ca547aca2931edde6d1e06 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '75', 'operation': 'evolve', 'user': 'test'}
  16810a5772dd9a27f4c0302d4e41009a2518588c 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  6a167ad77c24406c8093b735220c7fe75ed313a6 856e7b6a8392638923637851f93d2e6b4196c37f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  6a167ad77c24406c8093b735220c7fe75ed313a6 9916514079c2e21fac219b2e31735a065e83ced8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '68', 'operation': 'rebase', 'user': 'test'}
  9916514079c2e21fac219b2e31735a065e83ced8 750fd38fec355bf4dc56c36443c9b6d59670946c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  856e7b6a8392638923637851f93d2e6b4196c37f 1376c32668b4d8f3073bf8dde759afaf4ac512e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  750fd38fec355bf4dc56c36443c9b6d59670946c 68ce3ad10d102c3d5dafb324a1b90a0a356dbb8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  1376c32668b4d8f3073bf8dde759afaf4ac512e2 68ce3ad10d102c3d5dafb324a1b90a0a356dbb8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '74', 'operation': 'evolve', 'user': 'test'}
  $ hg obslog -r . --all
  @    68ce3ad10d10 (21) added y
  |\
  x |  1376c32668b4 (20) added y
  | |    rewritten(meta, branch, content) as 68ce3ad10d10 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  750fd38fec35 (19) added y
  | |    rewritten(meta, content) as 68ce3ad10d10 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  x |  856e7b6a8392 (17) added y
  | |    rebased(parent) as 1376c32668b4 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  9916514079c2 (18) added y
  |/     amended(content) as 750fd38fec35 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
  |
  x  6a167ad77c24 (16) added y
       amended(content) as 856e7b6a8392 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
       rewritten(branch, parent) as 9916514079c2 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
  

checking that relocated commit is there
  $ hg exp 20 --hidden
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Node ID 1376c32668b4d8f3073bf8dde759afaf4ac512e2
  # Parent  806f7694feb1c58fdd7bf656445f3bd5463a008e
  added y
  
  diff -r 806f7694feb1 -r 1376c32668b4 y
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
  @@ -0,0 +1,1 @@
  +bar

Testing when the relocation will result in conflicts and merging also:
----------------------------------------------------------------------

  $ hg glog
  @  21:68ce3ad10d10 added y
  |   () [bar] draft
  o  15:806f7694feb1 added foo to x
  |   () [bar] draft
  o  10:d34e10c64365 added d
  |   () [default] draft
  o  9:65f70b47129d added c
  |   () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg up .^^^^
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved

  $ echo z > z
  $ hg ci -Aqm "added z"
  $ hg glog -r .
  @  22:2d5d2b8719d6 added z
  |   () [default] draft
  ~

  $ echo foo > y
  $ hg add y
  $ hg amend

  $ hg up 'predecessors(.)' --hidden
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  updated to hidden changeset 2d5d2b8719d6
  (hidden revision '2d5d2b8719d6' was rewritten as: ff9e3b1b6df8)
  working directory parent is obsolete! (2d5d2b8719d6)
  (use 'hg evolve' to update to its successor: ff9e3b1b6df8)
  $ hg rebase -r . -d 'desc("added y")' --config experimental.evolution.allowdivergence=True
  rebasing 22:2d5d2b8719d6 "added z"
  2 new content-divergent changesets
  $ echo bar > z
  $ hg amend

  $ hg glog
  @  25:f8b6462d0f09 added z
  |   () [bar] draft
  | *  23:ff9e3b1b6df8 added z
  | |   () [default] draft
  o |  21:68ce3ad10d10 added y
  | |   () [bar] draft
  o |  15:806f7694feb1 added foo to x
  | |   () [bar] draft
  o |  10:d34e10c64365 added d
  | |   () [default] draft
  o |  9:65f70b47129d added c
  |/    () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg evolve --content-divergent --any
  merge:[25] added z
  with: [23] added z
  base: [22] added z
  rebasing "other" content-divergent changeset ff9e3b1b6df8 on 68ce3ad10d10
  merging y
  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
  unresolved merge conflicts
  (see 'hg help evolve.interrupted')
  [1]

  $ hg diff
  diff -r 68ce3ad10d10 y
  --- a/y	Thu Jan 01 00:00:00 1970 +0000
  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,5 @@
  +<<<<<<< destination: 68ce3ad10d10 bar - test: added y
   watbar
  +=======
  +foo
  +>>>>>>> evolving:    ff9e3b1b6df8 - test: added z
  diff -r 68ce3ad10d10 z
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
  @@ -0,0 +1,1 @@
  +z

  $ echo foo > y
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue

  $ hg evolve --continue
  evolving 23:ff9e3b1b6df8 "added z"
  merging y
  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  unresolved merge conflicts
  (see 'hg help evolve.interrupted')
  [1]

  $ hg diff
  diff -r f8b6462d0f09 y
  --- a/y	Thu Jan 01 00:00:00 1970 +0000
  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,5 @@
  +<<<<<<< local: f8b6462d0f09 bar - test: added z
   watbar
  +=======
  +foo
  +>>>>>>> other: 53bfc763e92e - test: added z

  $ echo foo > y
  $ hg resolve -m
  (no more unresolved files)
  continue: hg evolve --continue
  $ hg evolve --continue
  working directory is now at d17538c7d8eb

  $ hg glog
  @  27:d17538c7d8eb added z
  |   () [bar] draft
  o  21:68ce3ad10d10 added y
  |   () [bar] draft
  o  15:806f7694feb1 added foo to x
  |   () [bar] draft
  o  10:d34e10c64365 added d
  |   () [default] draft
  o  9:65f70b47129d added c
  |   () [default] draft
  o  8:f8f130ec5d39 added b
  |   () [default] draft
  o  1:c7586e2a9264 added a
  |   () [default] draft
  o  0:8fa14d15e168 added hgignore
      () [default] draft

  $ hg exp
  # HG changeset patch
  # User test
  # Date 0 0
  #      Thu Jan 01 00:00:00 1970 +0000
  # Branch bar
  # Node ID d17538c7d8eb057a9ed807d29ff951e9f7940e83
  # Parent  68ce3ad10d102c3d5dafb324a1b90a0a356dbb8e
  added z
  
  diff -r 68ce3ad10d10 -r d17538c7d8eb y
  --- a/y	Thu Jan 01 00:00:00 1970 +0000
  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
  @@ -1,1 +1,1 @@
  -watbar
  +foo
  diff -r 68ce3ad10d10 -r d17538c7d8eb z
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
  @@ -0,0 +1,1 @@
  +bar

  $ hg debugobsolete
  b1661037fa25511d0b7ccddf405e336f9d7d3424 7ed0642d644bb9ad93d252dd9ffe7b4729febe48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  b1661037fa25511d0b7ccddf405e336f9d7d3424 da4b96f4a8d610a85b225583138f681d67e275dd 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  da4b96f4a8d610a85b225583138f681d67e275dd 11f849d7159fa30a63dbbc1a6d251a8d996baeb5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  7ed0642d644bb9ad93d252dd9ffe7b4729febe48 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  11f849d7159fa30a63dbbc1a6d251a8d996baeb5 f8f130ec5d399699738abf984a885baa4fa9f06c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  ca1b80f7960aae2306287bab52b4090c59af8c29 65f70b47129d8466acbdc70bfb1efef3d05388e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  c41c793e0ef1ddb463e85ea9491e377d01127ba2 d34e10c643651d577eef840b427b58d9bd6ae3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 271db13e4ad11d4ca78b12e74e7341cb74c05a85 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '73', 'operation': 'amend', 'user': 'test'}
  19fde4a13e167ceb55fcfd7937268027f7e716f0 eb9a1b31b6d812c036ca547aca2931edde6d1e06 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
  271db13e4ad11d4ca78b12e74e7341cb74c05a85 16810a5772dd9a27f4c0302d4e41009a2518588c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  eb9a1b31b6d812c036ca547aca2931edde6d1e06 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '75', 'operation': 'evolve', 'user': 'test'}
  16810a5772dd9a27f4c0302d4e41009a2518588c 806f7694feb1c58fdd7bf656445f3bd5463a008e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'evolve', 'user': 'test'}
  6a167ad77c24406c8093b735220c7fe75ed313a6 856e7b6a8392638923637851f93d2e6b4196c37f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  6a167ad77c24406c8093b735220c7fe75ed313a6 9916514079c2e21fac219b2e31735a065e83ced8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '68', 'operation': 'rebase', 'user': 'test'}
  9916514079c2e21fac219b2e31735a065e83ced8 750fd38fec355bf4dc56c36443c9b6d59670946c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  856e7b6a8392638923637851f93d2e6b4196c37f 1376c32668b4d8f3073bf8dde759afaf4ac512e2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'evolve', 'user': 'test'}
  750fd38fec355bf4dc56c36443c9b6d59670946c 68ce3ad10d102c3d5dafb324a1b90a0a356dbb8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  1376c32668b4d8f3073bf8dde759afaf4ac512e2 68ce3ad10d102c3d5dafb324a1b90a0a356dbb8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '74', 'operation': 'evolve', 'user': 'test'}
  2d5d2b8719d63d07b1c4bf5b5ea30b924b00a83e ff9e3b1b6df81fe45e8aad1fa86145588da0d20f 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  2d5d2b8719d63d07b1c4bf5b5ea30b924b00a83e 30de78f605eb1cf2f31edfe9c34789118e7f47a0 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '68', 'operation': 'rebase', 'user': 'test'}
  30de78f605eb1cf2f31edfe9c34789118e7f47a0 f8b6462d0f09ea491c801a49094cb452d4197333 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
  ff9e3b1b6df81fe45e8aad1fa86145588da0d20f 53bfc763e92e5ce04f978fde72667eab1d7e01fb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'evolve', 'user': 'test'}
  f8b6462d0f09ea491c801a49094cb452d4197333 d17538c7d8eb057a9ed807d29ff951e9f7940e83 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '10', 'operation': 'evolve', 'user': 'test'}
  53bfc763e92e5ce04f978fde72667eab1d7e01fb d17538c7d8eb057a9ed807d29ff951e9f7940e83 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '74', 'operation': 'evolve', 'user': 'test'}
  $ hg obslog --all
  @    d17538c7d8eb (27) added z
  |\
  x |  53bfc763e92e (26) added z
  | |    rewritten(meta, branch, content) as d17538c7d8eb using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  f8b6462d0f09 (25) added z
  | |    rewritten(meta, content) as d17538c7d8eb using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  | x  30de78f605eb (24) added z
  | |    amended(content) as f8b6462d0f09 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
  | |
  x |  ff9e3b1b6df8 (23) added z
  |/     rewritten(parent, content) as 53bfc763e92e using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
  |
  x  2d5d2b8719d6 (22) added z
       rewritten(branch, parent) as 30de78f605eb using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
       amended(content) as ff9e3b1b6df8 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
  

  $ cd ..

Testing when relocation results in nothing to commit
----------------------------------------------------

Set up a repo where relocation results in no changes to commit because the
changes from the relocated node are already in the destination.

  $ hg init nothing-to-commit
  $ cd nothing-to-commit
  $ echo 0 > a
  $ hg ci -Aqm initial
  $ echo 1 > a
  $ hg ci -Aqm upstream
  $ hg prev -q

Create the source of divergence.
  $ echo 0 > b
  $ hg ci -Aqm divergent

The first side of the divergence get rebased on top of upstream.
  $ hg rebase -r . -d 'desc("upstream")'
  rebasing 2:898ddd4443b3 "divergent" (tip)
  $ hg --hidden co 2 -q
  updated to hidden changeset 898ddd4443b3
  (hidden revision '898ddd4443b3' was rewritten as: befae6138569)
  working directory parent is obsolete! (898ddd4443b3)

The other side of the divergence gets amended so it matches upstream.
Relocation (onto upstream) will therefore result in no changes to commit.
  $ hg revert -r 'desc("upstream")' --all
  removing b
  reverting a
  $ hg amend --config experimental.evolution.allowdivergence=True
  2 new content-divergent changesets

Add a commit on top. This one should become an orphan. Evolving it later
should put it on top of the other divergent side (the one that's on top of
upstream)
  $ echo 0 > c
  $ hg ci -Aqm child
  $ hg co -q null
  $ hg glog
  o  5:88473f9137d1 child
  |   () [default] draft
  *  4:4cc21313ecee divergent
  |   () [default] draft
  | *  3:befae6138569 divergent
  | |   () [default] draft
  | o  1:33c576d20069 upstream
  |/    () [default] draft
  o  0:98a3f8f02ba7 initial
      () [default] draft
  $ hg evolve --content-divergent 2>&1 | grep TypeError
  TypeError: expected *, NoneType found (glob)

  $ cd ..