test: consolidate the content-divergent test cases
This commit move most of the content divergent related test in dedicated and
thematic test files.
--- a/tests/test-divergent.t Tue Apr 09 21:16:49 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-Tests the resolution of divergence
-
- $ cat >> $HGRCPATH <<EOF
- > [defaults]
- > amend=-d "0 0"
- > fold=-d "0 0"
- > [web]
- > push_ssl = false
- > allow_push = *
- > [phases]
- > publish = False
- > [diff]
- > git = 1
- > unified = 0
- > [ui]
- > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
- > [extensions]
- > EOF
- $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
- $ mkcommit() {
- > echo "$1" > "$1"
- > hg add "$1"
- > hg ci -m "add $1"
- > }
-
- $ mkcommits() {
- > for i in $@; do mkcommit $i ; done
- > }
-
-Basic test of divergence: two divergent changesets with the same parents
-With --all --any we dedupe the divergent and solve the divergence once
-
- $ hg init test1
- $ cd test1
- $ echo a > a
- $ hg ci -Aqm "added a"
- $ echo b > b
- $ hg ci -Aqm "added b"
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo bdivergent > bdivergent1
- $ hg ci -Am "divergent"
- adding bdivergent1
- created new head
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo bdivergent > bdivergent2
- $ hg ci -Am "divergent"
- adding bdivergent2
- created new head
-
- $ hg prune -s 8374d2ddc3a4 "desc('added b')"
- 1 changesets pruned
- $ hg prune -s 593c57f2117e "desc('added b')" --hidden
- 1 changesets pruned
- 2 new content-divergent changesets
-
- $ hg log -G
- @ 3:8374d2ddc3a4@default(draft) divergent [content-divergent]
- |
- | * 2:593c57f2117e@default(draft) divergent [content-divergent]
- |/
- o 0:9092f1db7931@default(draft) added a []
-
-
- $ hg evolve --all --any --content-divergent
- merge:[2] divergent
- with: [3] divergent
- base: [1] added b
- updating to "local" side of the conflict: 593c57f2117e
- merging "other" content-divergent changeset '8374d2ddc3a4'
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at 45bf1312f454
- $ hg log -G
- @ 4:45bf1312f454@default(draft) divergent []
- |
- o 0:9092f1db7931@default(draft) added a []
-
-Test divergence resolution when it yields to an empty commit (issue4950)
-cdivergent2 contains the same content than cdivergent1 and they are divergent
-versions of the revision _c
-
- $ hg up .^
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- $ mkcommit _c
- created new head
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ mkcommit cdivergent1
- created new head
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo "cdivergent1" > cdivergent1
- $ hg add cdivergent1
- $ hg ci -m "add _c"
- created new head
-
- $ hg log -G
- @ 7:b2ae71172042@default(draft) add _c []
- |
- | o 6:e3ff64ce8d4c@default(draft) add cdivergent1 []
- |/
- | o 5:48819a835615@default(draft) add _c []
- |/
- | o 4:45bf1312f454@default(draft) divergent []
- |/
- o 0:9092f1db7931@default(draft) added a []
-
-
- $ hg prune -s b2ae71172042 48819a835615
- 1 changesets pruned
- $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden
- 1 changesets pruned
- 2 new content-divergent changesets
-
- $ hg log -G
- @ 7:b2ae71172042@default(draft) add _c [content-divergent]
- |
- | * 6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
- |/
- | o 4:45bf1312f454@default(draft) divergent []
- |/
- o 0:9092f1db7931@default(draft) added a []
-
- $ hg evolve --all --any --content-divergent
- merge:[6] add cdivergent1
- with: [7] add _c
- base: [5] add _c
- updating to "local" side of the conflict: e3ff64ce8d4c
- merging "other" content-divergent changeset 'b2ae71172042'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- nothing changed
- working directory is now at e3ff64ce8d4c
-
- $ cd ..
-
-Test None docstring issue of evolve divergent, which caused hg crush
-
- $ hg init test2
- $ cd test2
- $ mkcommits _a _b
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo bdivergent > bdivergent11
- $ hg ci -Am "bdivergent"
- adding bdivergent11
- created new head
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo bdivergent > bdivergent22
- $ hg ci -Am "bdivergent"
- adding bdivergent22
- created new head
-
- $ hg log -G
- @ 3:6b096fb45070@default(draft) bdivergent []
- |
- | o 2:05a6b6a9e633@default(draft) bdivergent []
- |/
- | o 1:37445b16603b@default(draft) add _b []
- |/
- o 0:135f39f4bd78@default(draft) add _a []
-
-
- $ hg prune -s 6b096fb45070 37445b16603b
- 1 changesets pruned
- $ hg prune -s 05a6b6a9e633 37445b16603b --hidden
- 1 changesets pruned
- 2 new content-divergent changesets
- $ hg log -G
- @ 3:6b096fb45070@default(draft) bdivergent [content-divergent]
- |
- | * 2:05a6b6a9e633@default(draft) bdivergent [content-divergent]
- |/
- o 0:135f39f4bd78@default(draft) add _a []
-
-
- $ cat >$TESTTMP/test_extension.py << EOF
- > from mercurial import merge
- > origupdate = merge.update
- > def newupdate(*args, **kwargs):
- > return origupdate(*args, **kwargs)
- > merge.update = newupdate
- > EOF
- $ cat >> $HGRCPATH << EOF
- > [extensions]
- > testextension=$TESTTMP/test_extension.py
- > EOF
- $ hg evolve --all
- nothing to evolve on current working copy parent
- (do you want to use --content-divergent)
- [2]
- $ hg evolve --content-divergent
- merge:[3] bdivergent
- with: [2] bdivergent
- base: [1] add _b
- merging "other" content-divergent changeset '05a6b6a9e633'
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at 73ff357d3975
-
- $ cd ..
--- a/tests/test-evolve-abort-contentdiv.t Tue Apr 09 21:16:49 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,376 +0,0 @@
-Tests for the --abort flag for `hg evolve` command while content-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 content-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 content divergence, resolution of which will lead to conflicts
------------------------------------------------------------------------
-
- $ echo bar > d
- $ hg amend
-
- $ hg up c41c793e0ef1 --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset c41c793e0ef1
- (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
- working directory parent is obsolete! (c41c793e0ef1)
- (use 'hg evolve' to update to its successor: e49523854bc8)
-
- $ echo foobar > d
- $ hg amend
- 2 new content-divergent changesets
- $ hg glog --hidden
- @ 6:9c1631e352d9 added d
- | () draft
- | * 5:e49523854bc8 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 evolve --content-divergent
- merge:[6] added d
- with: [5] added d
- base: [4] added d
- merging "other" content-divergent changeset 'e49523854bc8'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg status -v
- M d
- # The repository is in an unfinished *evolve* state.
-
- # Unresolved merge conflicts:
- #
- # d
- #
- # To mark files as resolved: hg resolve --mark FILE
-
- # To continue: hg evolve --continue
- # To abort: hg evolve --abort
- # To stop: hg evolve --stop
- # (also see `hg help evolve.interrupted`)
-
- $ hg parents
- changeset: 6:9c1631e352d9
- tag: tip
- parent: 3:ca1b80f7960a
- user: test
- date: Thu Jan 01 00:00:00 1970 +0000
- instability: content-divergent
- summary: added d
-
- changeset: 5:e49523854bc8
- parent: 3:ca1b80f7960a
- user: test
- date: Thu Jan 01 00:00:00 1970 +0000
- instability: content-divergent
- summary: added d
-
-
- $ hg evolve --abort
- evolve aborted
- working directory is now at 9c1631e352d9
-
- $ hg glog --hidden
- @ 6:9c1631e352d9 added d
- | () draft
- | * 5:e49523854bc8 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
-
-Creating multiple content-divergence where resolution of last one results in
-conflicts and resolution of first one resulted in no new commit
------------------------------------------------------------------------------
-
- $ echo watbar > d
- $ hg amend
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ echo bar > c
- $ hg amend
- 2 new orphan changesets
- $ hg up ca1b80f7960a --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory parent is obsolete! (ca1b80f7960a)
- (use 'hg evolve' to update to its successor: 2ba73e31f264)
- $ echo foobar > c
- $ hg amend
- 2 new content-divergent changesets
- $ echo bar > c
- $ hg amend
-
- $ hg glog --hidden
- @ 10:491e10505bae added c
- | () draft
- | x 9:7398f702a162 added c
- |/ () draft
- | * 8:2ba73e31f264 added c
- |/ () draft
- | * 7:f0f1694f123e added d
- | | () draft
- | | x 6:9c1631e352d9 added d
- | |/ () draft
- | | * 5:e49523854bc8 added d
- | |/ () draft
- | | x 4:c41c793e0ef1 added d
- | |/ () draft
- | x 3:ca1b80f7960a added c
- |/ () draft
- o 2:b1661037fa25 added b
- | () draft
- o 1:c7586e2a9264 added a
- | () draft
- o 0:8fa14d15e168 added hgignore
- () draft
-
- $ hg evolve --all --content-divergent
- merge:[8] added c
- with: [10] added c
- base: [3] added c
- updating to "local" side of the conflict: 2ba73e31f264
- merging "other" content-divergent changeset '491e10505bae'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- merge:[5] added d
- with: [7] added d
- base: [4] added d
- updating to "local" side of the conflict: e49523854bc8
- merging "other" content-divergent changeset 'f0f1694f123e'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg evolve --abort
- 2 new content-divergent changesets
- evolve aborted
- working directory is now at 491e10505bae
-
- $ hg glog --hidden
- @ 10:491e10505bae added c
- | () draft
- | x 9:7398f702a162 added c
- |/ () draft
- | * 8:2ba73e31f264 added c
- |/ () draft
- | * 7:f0f1694f123e added d
- | | () draft
- | | x 6:9c1631e352d9 added d
- | |/ () draft
- | | * 5:e49523854bc8 added d
- | |/ () draft
- | | x 4:c41c793e0ef1 added d
- | |/ () draft
- | x 3:ca1b80f7960a added c
- |/ () draft
- o 2:b1661037fa25 added b
- | () draft
- o 1:c7586e2a9264 added a
- | () draft
- o 0:8fa14d15e168 added hgignore
- () draft
-
- $ hg obslog -r . --all
- * 2ba73e31f264 (8) added c
- |
- | @ 491e10505bae (10) added c
- | |
- | x 7398f702a162 (9) added c
- |/ rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
- |
- x ca1b80f7960a (3) added c
- rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
- rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
-
- $ cd ..
-
-Creating content-divergence on multiple parents when gca of divergent changesets
-is parent of one of the divergents and relocating leads to conflicts
----------------------------------------------------------------------------------
-
- $ hg init multiparent
- $ cd multiparent
- $ 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
-
- $ hg rebase -r . -d .^^^ --config extensions.rebase=
- rebasing 4:c41c793e0ef1 "added d" (tip)
- $ echo bar > c
- $ hg add c
- $ hg amend
-
- $ hg up --hidden c41c793e0ef1
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset c41c793e0ef1
- (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
- working directory parent is obsolete! (c41c793e0ef1)
- (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
- $ echo bar > d
- $ hg amend
- 2 new content-divergent changesets
-
- $ hg glog
- @ 7:e49523854bc8 added d
- | () draft
- | * 6:69bdd23a9b0d 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 evolve --content-divergent
- merge:[7] added d
- with: [6] added d
- base: [4] added d
- rebasing "other" content-divergent changeset 69bdd23a9b0d on 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 e49523854bc8
-
- $ hg glog
- @ 7:e49523854bc8 added d
- | () draft
- | * 6:69bdd23a9b0d 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 content-divergence on multiple parents when gca of divergent changesets
-is parent of one of the divergents and merging divergent leads to conflicts
----------------------------------------------------------------------------------
-
- $ hg up 69bdd23a9b0d
- 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
- $ hg rm c
- $ echo wat > d
- $ hg amend
-
- $ hg glog
- @ 8:33e4442acf98 added d
- | () draft
- | * 7:e49523854bc8 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 evolve --content-divergent
- merge:[7] added d
- with: [8] added d
- base: [4] added d
- rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
- updating to "local" side of the conflict: e49523854bc8
- merging "other" content-divergent changeset 'a663d1567f0b'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg evolve --abort
- evolve aborted
- working directory is now at 33e4442acf98
-
- $ hg glog
- @ 8:33e4442acf98 added d
- | () draft
- | * 7:e49523854bc8 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
--- a/tests/test-evolve-content-divergence.t Tue Apr 09 21:16:49 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1036 +0,0 @@
-** Test for handling of content divergent changesets by `hg evolve` **
-====================================================================
-
- $ 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
-
- $ hg init cdiv
- $ cd cdiv
- $ 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
-
-Creating content-divergence with branch change where base, divergent and other
-have different branches
--------------------------------------------------------------------------------
-
- $ hg branch -r . foobar
- changed branch on 1 changesets
-
- $ hg up c41c793e0ef1 --hidden
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset c41c793e0ef1
- (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48)
- working directory parent is obsolete! (c41c793e0ef1)
- (use 'hg evolve' to update to its successor: 9e5dffcb3d48)
- $ echo bar > d
- $ hg branch watwat
- marked working directory as branch watwat
- $ hg amend
- 2 new content-divergent changesets
-
- $ hg glog
- @ 6:264b04f771fb added d
- | () [watwat] draft
- | * 5:9e5dffcb3d48 added d
- |/ () [foobar] 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 evolve --content-divergent --config ui.interactive=True<<EOF
- > c
- > EOF
- merge:[6] added d
- with: [5] added d
- base: [4] added d
- merging "other" content-divergent changeset '9e5dffcb3d48'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- content divergent changesets on different branches.
- choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar? c
- working directory is now at 0ac42f1bc15c
-
- $ hg glog
- @ 7:0ac42f1bc15c added d
- | () [foobar] 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
-
-Testing merging of commit messages
------------------------------------
-
-When base and one of the divergent has same commit messages and other divergent
-has different one
-
- $ echo wat > d
- $ hg amend
-
- $ hg up .^
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-
- $ echo bar > d
- $ hg ci -Aqm "added a d with bar in it, expect some beers"
-
- $ hg prune -r 0ac42f1bc15c -s . --hidden
- 1 changesets pruned
- 2 new content-divergent changesets
-
- $ hg glog
- @ 9:59081c9c425a added a d with bar in it, expect some beers
- | () [default] draft
- | * 8:f621d00f5f0e added d
- |/ () [foobar] 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 evolve --content-divergent
- merge:[9] added a d with bar in it, expect some beers
- with: [8] added d
- base: [7] added d
- merging "other" content-divergent changeset 'f621d00f5f0e'
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at a9d6fd6b5e40
-
- $ hg glog
- @ 10:a9d6fd6b5e40 added a d with bar in it, expect some beers
- | () [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
-
-When base has different message and both divergents has same one
-
- $ echo foo > d
- $ hg amend -m "foo to d"
-
- $ hg up a9d6fd6b5e40 --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset a9d6fd6b5e40
- (hidden revision 'a9d6fd6b5e40' was rewritten as: b10b07a394f1)
- working directory parent is obsolete! (a9d6fd6b5e40)
- (use 'hg evolve' to update to its successor: b10b07a394f1)
- $ echo babar > d
- $ hg amend -m "foo to d"
- 2 new content-divergent changesets
-
- $ hg glog
- @ 12:0bb497fed24a foo to d
- | () [default] draft
- | * 11:b10b07a394f1 foo to 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 evolve --content-divergent
- merge:[12] foo to d
- with: [11] foo to d
- base: [10] added a d with bar in it, expect some beers
- merging "other" content-divergent changeset 'b10b07a394f1'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ echo foobar > d
- $ hg resolve -m
- (no more unresolved files)
- continue: hg evolve --continue
- $ hg evolve --continue
- working directory is now at 11175423b5dc
-
- $ hg glog
- @ 13:11175423b5dc foo to 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
-
-When all three base, divergent and other has different commit messages creating
-conflicts
-
- $ echo bar > d
- $ hg amend -m "bar to d, expect beers"
-
- $ hg up 11175423b5dc --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset 11175423b5dc
- (hidden revision '11175423b5dc' was rewritten as: 27f0463f169a)
- working directory parent is obsolete! (11175423b5dc)
- (use 'hg evolve' to update to its successor: 27f0463f169a)
- $ echo wat > d
- $ hg amend -m "wat to d, wat?"
- 2 new content-divergent changesets
-
- $ hg glog
- @ 15:f542037ddf31 wat to d, wat?
- | () [default] draft
- | * 14:27f0463f169a bar to d, expect beers
- |/ () [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 evolve --content-divergent
- merge:[15] wat to d, wat?
- with: [14] bar to d, expect beers
- base: [13] foo to d
- merging "other" content-divergent changeset '27f0463f169a'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ echo watbar > d
- $ hg resolve -m
- (no more unresolved files)
- continue: hg evolve --continue
-
- $ cat > editor.sh <<EOF
- > #!/bin/sh
- > printf "**showing editors text**\n\n"
- > cat \$1
- > printf "\n**done showing editors text**\n\n"
- > cat > \$1 <<ENDOF
- > watbar to d
- > ENDOF
- > EOF
-
- $ HGEDITOR='sh ./editor.sh' hg evolve --continue
- **showing editors text**
-
- HG: Conflicts while merging changeset description of content-divergent changesets.
- HG: Resolve conflicts in commit messages to continue.
-
- <<<<<<< divergent
- wat to d, wat?||||||| base
- foo to d=======
- bar to d, expect beers>>>>>>> other
-
- **done showing editors text**
-
- working directory is now at 89ea3eee2d69
-
- $ hg glog
- @ 16:89ea3eee2d69 watbar to 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
-
- $ cd ..
-
-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
- updating to "local" side of the conflict: 7ed0642d644b
- merging "other" content-divergent changeset '11f849d7159f'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at 171614c9a791
-
- $ hg glog
- @ 8:171614c9a791 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 171614c9a7914c53f531373b95632323fdbbac8d
- # Parent c7586e2a92645e473645847a7b69a6dc52be4276
- added b
-
- diff -r c7586e2a9264 -r 171614c9a791 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
-
-Resolving orphans to get back to a normal graph
-
- $ hg evolve --all
- move:[3] added c
- atop:[8] added b
- move:[4] added d
- working directory is now at 4ae4427ee9f8
- $ hg glog
- @ 10:4ae4427ee9f8 added d
- | () [default] draft
- o 9:917281f93fcb added c
- | () [default] draft
- o 8:171614c9a791 added b
- | () [default] draft
- o 1:c7586e2a9264 added a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
-More testing!
-
- $ hg up .^^
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- $ echo x > x
- $ hg ci -Aqm "added x"
- $ hg glog -r .
- @ 11:71a392c714b5 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 71a392c714b5 --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset 71a392c714b5
- (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d)
- working directory parent is obsolete! (71a392c714b5)
- (use 'hg evolve' to update to its successor: 1e1a50385a7d)
- $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True
- rebasing 11:71a392c714b5 "added x"
- 2 new content-divergent changesets
-
- $ hg glog
- @ 13:1e4f6b3bb39b added x
- | () [default] draft
- | * 12:1e1a50385a7d added foo to x
- | | () [bar] draft
- o | 10:4ae4427ee9f8 added d
- | | () [default] draft
- o | 9:917281f93fcb added c
- |/ () [default] draft
- o 8:171614c9a791 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 1e1a50385a7d on 4ae4427ee9f8
- updating to "local" side of the conflict: 1e4f6b3bb39b
- merging "other" content-divergent changeset '80cc9b1ec650'
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at b006cf317e0e
-
- $ hg exp
- # HG changeset patch
- # User test
- # Date 0 0
- # Thu Jan 01 00:00:00 1970 +0000
- # Branch bar
- # Node ID b006cf317e0ed16dbe786c439577475580f645f1
- # Parent 4ae4427ee9f8f0935211fd66360948b77ab5aee9
- added foo to x
-
- diff -r 4ae4427ee9f8 -r b006cf317e0e 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:b006cf317e0e added foo to x
- | () [bar] draft
- o 10:4ae4427ee9f8 added d
- | () [default] draft
- o 9:917281f93fcb added c
- | () [default] draft
- o 8:171614c9a791 added b
- | () [default] draft
- o 1:c7586e2a9264 added a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
-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:fc6ad2bac162 added y
- | () [default] draft
- ~
-
- $ echo bar > y
- $ hg amend
-
- $ hg up fc6ad2bac162 --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset fc6ad2bac162
- (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba)
- working directory parent is obsolete! (fc6ad2bac162)
- (use 'hg evolve' to update to its successor: 2a9f6ccbdeba)
- $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True
- rebasing 16:fc6ad2bac162 "added y"
- 2 new content-divergent changesets
- $ echo wat > y
- $ hg amend
-
- $ hg glog
- @ 19:b4575ed6fcfc added y
- | () [bar] draft
- | * 17:2a9f6ccbdeba added y
- | | () [default] draft
- o | 15:b006cf317e0e added foo to x
- | | () [bar] draft
- o | 10:4ae4427ee9f8 added d
- | | () [default] draft
- o | 9:917281f93fcb added c
- |/ () [default] draft
- o 8:171614c9a791 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 2a9f6ccbdeba on b006cf317e0e
- updating to "local" side of the conflict: b4575ed6fcfc
- merging "other" content-divergent changeset '48f745db3f53'
- 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
- fix conflicts and 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 7bbcf24ddecf
-
- $ hg glog
- @ 21:7bbcf24ddecf added y
- | () [bar] draft
- o 15:b006cf317e0e added foo to x
- | () [bar] draft
- o 10:4ae4427ee9f8 added d
- | () [default] draft
- o 9:917281f93fcb added c
- | () [default] draft
- o 8:171614c9a791 added b
- | () [default] draft
- o 1:c7586e2a9264 added a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
- $ hg obslog -r . --all
- @ 7bbcf24ddecf (21) added y
- |\
- x | 48f745db3f53 (20) added y
- | | rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
- | |
- | x b4575ed6fcfc (19) added y
- | | rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
- | |
- x | 2a9f6ccbdeba (17) added y
- | | rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
- | |
- | x 96b677f01b81 (18) added y
- |/ rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000)
- |
- x fc6ad2bac162 (16) added y
- rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000)
- rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
-
-
-checking that relocated commit is there
- $ hg exp 48f745db3f53 --hidden
- # HG changeset patch
- # User test
- # Date 0 0
- # Thu Jan 01 00:00:00 1970 +0000
- # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3
- # Parent b006cf317e0ed16dbe786c439577475580f645f1
- added y
-
- diff -r b006cf317e0e -r 48f745db3f53 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 wont
-----------------------------------------------------------------------
-
- $ hg glog
- @ 21:7bbcf24ddecf added y
- | () [bar] draft
- o 15:b006cf317e0e added foo to x
- | () [bar] draft
- o 10:4ae4427ee9f8 added d
- | () [default] draft
- o 9:917281f93fcb added c
- | () [default] draft
- o 8:171614c9a791 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:daf1de08f3b0 added z
- | () [default] draft
- ~
-
- $ echo foo > y
- $ hg add y
- $ hg amend
-
- $ hg up daf1de08f3b0 --hidden
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- updated to hidden changeset daf1de08f3b0
- (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080)
- working directory parent is obsolete! (daf1de08f3b0)
- (use 'hg evolve' to update to its successor: 3f7a1f693080)
- $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True
- rebasing 22:daf1de08f3b0 "added z"
- 2 new content-divergent changesets
- $ echo bar > z
- $ hg amend
-
- $ hg glog
- @ 25:53242575ffa9 added z
- | () [bar] draft
- | * 23:3f7a1f693080 added z
- | | () [default] draft
- o | 21:7bbcf24ddecf added y
- | | () [bar] draft
- o | 15:b006cf317e0e added foo to x
- | | () [bar] draft
- o | 10:4ae4427ee9f8 added d
- | | () [default] draft
- o | 9:917281f93fcb added c
- |/ () [default] draft
- o 8:171614c9a791 added b
- | () [default] draft
- o 1:c7586e2a9264 added a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
- $ hg evolve --content-divergent
- merge:[25] added z
- with: [23] added z
- base: [22] added z
- rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf
- merging y
- warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg diff
- diff -r 7bbcf24ddecf 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: 7bbcf24ddecf bar - test: added y
- watbar
- +=======
- +foo
- +>>>>>>> evolving: 3f7a1f693080 - test: added z
- diff -r 7bbcf24ddecf 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:3f7a1f693080 "added z"
- updating to "local" side of the conflict: 53242575ffa9
- merging "other" content-divergent changeset 'cdb0643c69fc'
- 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
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg diff
- diff -r 53242575ffa9 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: 53242575ffa9 bar - test: added z
- watbar
- +=======
- +foo
- +>>>>>>> other: cdb0643c69fc - 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 6fc7d9682de6
-
- $ hg glog
- @ 27:6fc7d9682de6 added z
- | () [bar] draft
- o 21:7bbcf24ddecf added y
- | () [bar] draft
- o 15:b006cf317e0e added foo to x
- | () [bar] draft
- o 10:4ae4427ee9f8 added d
- | () [default] draft
- o 9:917281f93fcb added c
- | () [default] draft
- o 8:171614c9a791 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 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4
- # Parent 7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b
- added z
-
- diff -r 7bbcf24ddecf -r 6fc7d9682de6 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 7bbcf24ddecf -r 6fc7d9682de6 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
-
- $ cd ..
-
-Resolving content-divergence of a stack with same parents
----------------------------------------------------------
-
- $ hg init stacktest
- $ cd stacktest
- $ 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
-
- $ cd ..
- $ hg init stack2
- $ cd stack2
- $ hg pull ../stacktest
- pulling from ../stacktest
- requesting all changes
- adding changesets
- adding manifests
- adding file changes
- added 5 changesets with 5 changes to 5 files
- new changesets 8fa14d15e168:c41c793e0ef1 (5 drafts)
- (run 'hg update' to get a working copy)
- $ hg glog
- o 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 c7586e2a9264
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ echo bar > a
- $ hg amend -m "watbar to a"
- 3 new orphan changesets
- $ echo wat > a
- $ hg amend -m "watbar to a"
- $ hg evolve --all
- move:[2] added b
- atop:[6] watbar to a
- move:[3] added c
- move:[4] added d
- working directory is now at 15c781f93cac
- $ hg glog
- @ 9:15c781f93cac added d
- | () [default] draft
- o 8:9e5fb1d5b955 added c
- | () [default] draft
- o 7:88516dccf68a added b
- | () [default] draft
- o 6:82b74d5dc678 watbar to a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
- $ cd ../stacktest
- $ hg up .^^^
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
- $ echo wat > a
- $ hg amend -m "watbar to a"
- 3 new orphan changesets
- $ hg evolve --all
- move:[2] added b
- atop:[5] watbar to a
- move:[3] added c
- move:[4] added d
- working directory is now at c72d2885eb51
- $ hg glog
- @ 8:c72d2885eb51 added d
- | () [default] draft
- o 7:3ce4be6d8e5e added c
- | () [default] draft
- o 6:d5f148423c16 added b
- | () [default] draft
- o 5:8e222f257bbf watbar to a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
- $ hg pull ../stack2
- pulling from ../stack2
- searching for changes
- adding changesets
- adding manifests
- adding file changes
- added 4 changesets with 0 changes to 4 files (+1 heads)
- 5 new obsolescence markers
- 8 new content-divergent changesets
- new changesets 82b74d5dc678:15c781f93cac (4 drafts)
- (run 'hg heads' to see heads, 'hg merge' to merge)
-
- $ hg glog
- * 12:15c781f93cac added d
- | () [default] draft
- * 11:9e5fb1d5b955 added c
- | () [default] draft
- * 10:88516dccf68a added b
- | () [default] draft
- * 9:82b74d5dc678 watbar to a
- | () [default] draft
- | @ 8:c72d2885eb51 added d
- | | () [default] draft
- | * 7:3ce4be6d8e5e added c
- | | () [default] draft
- | * 6:d5f148423c16 added b
- | | () [default] draft
- | * 5:8e222f257bbf watbar to a
- |/ () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
- $ hg evolve --all --content-divergent
- merge:[5] watbar to a
- with: [9] watbar to a
- base: [1] added a
- updating to "local" side of the conflict: 8e222f257bbf
- merging "other" content-divergent changeset '82b74d5dc678'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- 6 new orphan changesets
- merge:[6] added b
- with: [10] added b
- base: [2] added b
- updating to "local" side of the conflict: d5f148423c16
- merging "other" content-divergent changeset '88516dccf68a'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- merge:[7] added c
- with: [11] added c
- base: [3] added c
- updating to "local" side of the conflict: 3ce4be6d8e5e
- merging "other" content-divergent changeset '9e5fb1d5b955'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- merge:[8] added d
- with: [12] added d
- base: [4] added d
- updating to "local" side of the conflict: c72d2885eb51
- merging "other" content-divergent changeset '15c781f93cac'
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at 038fe7db3d88
-
- $ hg glog
- @ 16:038fe7db3d88 added d
- | () [default] draft
- o 15:b2cac10f3836 added c
- | () [default] draft
- o 14:eadfd9d70680 added b
- | () [default] draft
- o 13:f66f262fff6c watbar to a
- | () [default] draft
- o 0:8fa14d15e168 added hgignore
- () [default] draft
-
-
-Test to make sure that evolve don't fall into unrecoverable state (issue6053)
-------------------------------------------------------------------------------
-
-It happened when two divergent csets has different parent (need relocation)
-and resolution parent is obsolete. So this issue triggered when during
-relocation we hit conflicts. So lets make the repo as described.
-
- $ cd ..
- $ hg init localside
- $ cd localside
- $ for ch in a b c d e; do
- > echo $ch > $ch;
- > hg add $ch;
- > hg ci -m "added "$ch;
- > done;
-
- $ hg glog
- @ 4:8d71eadcc9df added e
- | () [default] draft
- o 3:9150fe93bec6 added d
- | () [default] draft
- o 2:155349b645be added c
- | () [default] draft
- o 1:5f6d8a4bf34a added b
- | () [default] draft
- o 0:9092f1db7931 added a
- () [default] draft
-
- $ echo ee > e
- $ hg amend -m "updated e"
- $ hg up 1 -q
-
-To make sure we hit conflict while relocating
- $ echo dd > d
- $ echo ee > e
- $ hg add d e
- $ hg ci -m "updated e"
- created new head
-
-Lets create divergence
- $ hg prune 4 -s . --hidden
- 1 changesets pruned
- 2 new content-divergent changesets
-
-Making obsolete resolution parent
- $ hg prune 3
- 1 changesets pruned
- 1 new orphan changesets
-
- $ hg glog
- @ 6:de4ea3103326 updated e
- | () [default] draft
- | * 5:ff6f7cd76a7c updated e
- | | () [default] draft
- | x 3:9150fe93bec6 added d
- | | () [default] draft
- | o 2:155349b645be added c
- |/ () [default] draft
- o 1:5f6d8a4bf34a added b
- | () [default] draft
- o 0:9092f1db7931 added a
- () [default] draft
-
- $ hg evolve --content-divergent --any
- merge:[5] updated e
- with: [6] updated e
- base: [4] added e
- rebasing "other" content-divergent changeset de4ea3103326 on 9150fe93bec6
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg diff
- diff -r 9150fe93bec6 d
- --- a/d Thu Jan 01 00:00:00 1970 +0000
- +++ b/d Thu Jan 01 00:00:00 1970 +0000
- @@ -1,1 +1,5 @@
- +<<<<<<< destination: 9150fe93bec6 - test: added d
- d
- +=======
- +dd
- +>>>>>>> evolving: de4ea3103326 - test: updated e
- diff -r 9150fe93bec6 e
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/e Thu Jan 01 00:00:00 1970 +0000
- @@ -0,0 +1,1 @@
- +ee
-
- $ echo dresolved > d
- $ hg res -m
- (no more unresolved files)
- continue: hg evolve --continue
-
- $ hg evolve --continue
- evolving 6:de4ea3103326 "updated e"
- updating to "local" side of the conflict: ff6f7cd76a7c
- merging "other" content-divergent changeset 'e504bd82de7e'
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- working directory is now at 83b1664a580f
-
- $ hg glog -l1
- @ 8:83b1664a580f updated e
- | () [default] draft
- ~
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-basic.t Wed Apr 10 14:32:00 2019 +0200
@@ -0,0 +1,578 @@
+=======================================================
+Tests the resolution of content divergence: basic cases
+=======================================================
+
+This file intend to cover basic case of content divergence. See the other test
+file for more advanced cases.
+
+ $ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+ > [defaults]
+ > amend=-d "0 0"
+ > fold=-d "0 0"
+ > [web]
+ > push_ssl = false
+ > allow_push = *
+ > [phases]
+ > publish = False
+ > [diff]
+ > git = 1
+ > unified = 0
+ > [ui]
+ > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+ > [extensions]
+ > EOF
+ $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+ $ mkcommit() {
+ > echo "$1" > "$1"
+ > hg add "$1"
+ > hg ci -m "add $1"
+ > }
+
+ $ mkcommits() {
+ > for i in $@; do mkcommit $i ; done
+ > }
+
+Basic test of divergence: two divergent changesets with the same parents
+With --all --any we dedupe the divergent and solve the divergence once
+
+ $ hg init test1
+ $ cd test1
+ $ echo a > a
+ $ hg ci -Aqm "added a"
+ $ echo b > b
+ $ hg ci -Aqm "added b"
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent1
+ $ hg ci -Am "divergent"
+ adding bdivergent1
+ created new head
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent2
+ $ hg ci -Am "divergent"
+ adding bdivergent2
+ created new head
+
+ $ hg prune -s 8374d2ddc3a4 "desc('added b')"
+ 1 changesets pruned
+ $ hg prune -s 593c57f2117e "desc('added b')" --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+ $ hg log -G
+ @ 3:8374d2ddc3a4@default(draft) divergent [content-divergent]
+ |
+ | * 2:593c57f2117e@default(draft) divergent [content-divergent]
+ |/
+ o 0:9092f1db7931@default(draft) added a []
+
+
+ $ hg evolve --all --any --content-divergent
+ merge:[2] divergent
+ with: [3] divergent
+ base: [1] added b
+ updating to "local" side of the conflict: 593c57f2117e
+ merging "other" content-divergent changeset '8374d2ddc3a4'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 45bf1312f454
+ $ hg log -G
+ @ 4:45bf1312f454@default(draft) divergent []
+ |
+ o 0:9092f1db7931@default(draft) added a []
+
+
+ $ cd ..
+
+Extra setup
+-----------
+
+(the test below were initially in a different file)
+
+ $ hg init cdiv
+ $ cd cdiv
+ $ 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
+
+Merging branch difference
+-------------------------
+
+Creating content-divergence with branch change where base, divergent and other
+have different branches
+
+ $ hg branch -r . foobar
+ changed branch on 1 changesets
+
+ $ hg up c41c793e0ef1 --hidden
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset c41c793e0ef1
+ (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48)
+ working directory parent is obsolete! (c41c793e0ef1)
+ (use 'hg evolve' to update to its successor: 9e5dffcb3d48)
+ $ echo bar > d
+ $ hg branch watwat
+ marked working directory as branch watwat
+ $ hg amend
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 6:264b04f771fb added d
+ | () [watwat] draft
+ | * 5:9e5dffcb3d48 added d
+ |/ () [foobar] 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 evolve --content-divergent --config ui.interactive=True<<EOF
+ > c
+ > EOF
+ merge:[6] added d
+ with: [5] added d
+ base: [4] added d
+ merging "other" content-divergent changeset '9e5dffcb3d48'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ content divergent changesets on different branches.
+ choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar? c
+ working directory is now at 0ac42f1bc15c
+
+ $ hg glog
+ @ 7:0ac42f1bc15c added d
+ | () [foobar] 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
+
+Testing merging of commit messages
+-----------------------------------
+
+When base and one of the divergent has same commit messages and other divergent
+has different one
+
+ $ echo wat > d
+ $ hg amend
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+ $ echo bar > d
+ $ hg ci -Aqm "added a d with bar in it, expect some beers"
+
+ $ hg prune -r 0ac42f1bc15c -s . --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 9:59081c9c425a added a d with bar in it, expect some beers
+ | () [default] draft
+ | * 8:f621d00f5f0e added d
+ |/ () [foobar] 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 evolve --content-divergent
+ merge:[9] added a d with bar in it, expect some beers
+ with: [8] added d
+ base: [7] added d
+ merging "other" content-divergent changeset 'f621d00f5f0e'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at a9d6fd6b5e40
+
+ $ hg glog
+ @ 10:a9d6fd6b5e40 added a d with bar in it, expect some beers
+ | () [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
+
+When base has different message and both divergents has same one
+
+ $ echo foo > d
+ $ hg amend -m "foo to d"
+
+ $ hg up a9d6fd6b5e40 --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset a9d6fd6b5e40
+ (hidden revision 'a9d6fd6b5e40' was rewritten as: b10b07a394f1)
+ working directory parent is obsolete! (a9d6fd6b5e40)
+ (use 'hg evolve' to update to its successor: b10b07a394f1)
+ $ echo babar > d
+ $ hg amend -m "foo to d"
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 12:0bb497fed24a foo to d
+ | () [default] draft
+ | * 11:b10b07a394f1 foo to 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 evolve --content-divergent
+ merge:[12] foo to d
+ with: [11] foo to d
+ base: [10] added a d with bar in it, expect some beers
+ merging "other" content-divergent changeset 'b10b07a394f1'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ echo foobar > d
+ $ hg resolve -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+ $ hg evolve --continue
+ working directory is now at 11175423b5dc
+
+ $ hg glog
+ @ 13:11175423b5dc foo to 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
+
+When all three base, divergent and other has different commit messages creating
+conflicts
+
+ $ echo bar > d
+ $ hg amend -m "bar to d, expect beers"
+
+ $ hg up 11175423b5dc --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset 11175423b5dc
+ (hidden revision '11175423b5dc' was rewritten as: 27f0463f169a)
+ working directory parent is obsolete! (11175423b5dc)
+ (use 'hg evolve' to update to its successor: 27f0463f169a)
+ $ echo wat > d
+ $ hg amend -m "wat to d, wat?"
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 15:f542037ddf31 wat to d, wat?
+ | () [default] draft
+ | * 14:27f0463f169a bar to d, expect beers
+ |/ () [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 evolve --content-divergent
+ merge:[15] wat to d, wat?
+ with: [14] bar to d, expect beers
+ base: [13] foo to d
+ merging "other" content-divergent changeset '27f0463f169a'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ echo watbar > d
+ $ hg resolve -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ cat > editor.sh <<EOF
+ > #!/bin/sh
+ > printf "**showing editors text**\n\n"
+ > cat \$1
+ > printf "\n**done showing editors text**\n\n"
+ > cat > \$1 <<ENDOF
+ > watbar to d
+ > ENDOF
+ > EOF
+
+ $ HGEDITOR='sh ./editor.sh' hg evolve --continue
+ **showing editors text**
+
+ HG: Conflicts while merging changeset description of content-divergent changesets.
+ HG: Resolve conflicts in commit messages to continue.
+
+ <<<<<<< divergent
+ wat to d, wat?||||||| base
+ foo to d=======
+ bar to d, expect beers>>>>>>> other
+
+ **done showing editors text**
+
+ working directory is now at 89ea3eee2d69
+
+ $ hg glog
+ @ 16:89ea3eee2d69 watbar to 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
+
+ $ cd ..
+
+Stabilize divergent changesets with same parent
+===============================================
+
+ $ glog() {
+ > hg log -G --template \
+ > '{rev}:{node|short}@{branch}({phase}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
+ > }
+
+ $ hg init content-divergent-savanna
+ $ cd content-divergent-savanna
+ $ echo a > a
+ $ hg add a
+ $ hg ci -m 'root'
+ $ hg phase --public .
+ $ cat << EOF >> a
+ > flore
+ > arthur
+ > zephir
+ > some
+ > less
+ > conflict
+ > EOF
+ $ hg ci -m 'More addition'
+ $ glog
+ @ 1:867e43582046@default(draft) bk:[] More addition
+ |
+ o 0:6569b5a81c7e@default(public) bk:[] root
+
+ $ echo 'babar' >> a
+ $ hg amend
+ $ hg up --hidden 'min(desc("More addition"))'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset 867e43582046
+ (hidden revision '867e43582046' was rewritten as: fc6349f931da)
+ working directory parent is obsolete! (867e43582046)
+ (use 'hg evolve' to update to its successor: fc6349f931da)
+ $ mv a a.old
+ $ echo 'jungle' > a
+ $ cat a.old >> a
+ $ rm a.old
+ $ hg amend
+ 2 new content-divergent changesets
+ $ glog
+ @ 3:051337a45e7c@default(draft) bk:[] More addition
+ |
+ | * 2:fc6349f931da@default(draft) bk:[] More addition
+ |/
+ o 0:6569b5a81c7e@default(public) bk:[] root
+
+
+Stabilize it
+
+ $ hg evolve -qn --confirm --content-divergent
+ merge:[3] More addition
+ with: [2] More addition
+ base: [1] More addition
+ perform evolve? [Ny] n
+ abort: evolve aborted by user
+ [255]
+ $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
+ merge:[3] More addition
+ with: [2] More addition
+ base: [1] More addition
+ perform evolve? [Ny] y
+ hg update -c 051337a45e7c &&
+ hg merge fc6349f931da &&
+ hg commit -m "auto merge resolving conflict between 051337a45e7c and fc6349f931da"&&
+ hg up -C 867e43582046 &&
+ hg revert --all --rev tip &&
+ hg commit -m "`hg log -r 051337a45e7c --template={desc}`";
+ $ hg evolve -v --content-divergent
+ merge:[3] More addition
+ with: [2] More addition
+ base: [1] More addition
+ merging "other" content-divergent changeset 'fc6349f931da'
+ resolving manifests
+ merging a
+ 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+ committing files:
+ a
+ committing manifest
+ committing changelog
+ working directory is now at 5bf84d1d71d1
+ $ hg st
+ $ glog
+ @ 4:5bf84d1d71d1@default(draft) bk:[] More addition
+ |
+ o 0:6569b5a81c7e@default(public) bk:[] root
+
+ $ hg summary
+ parent: 4:5bf84d1d71d1 tip
+ More addition
+ branch: default
+ commit: (clean)
+ update: (current)
+ phases: 1 draft
+ $ hg export . --config diff.unified=3
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID 5bf84d1d71d12f451bfe1e09b93045eb6338cd6c
+ # Parent 6569b5a81c7e307ddc076550e8c0f6d75b6effcd
+ More addition
+
+ diff --git a/a b/a
+ --- a/a
+ +++ b/a
+ @@ -1,1 +1,9 @@
+ +jungle
+ a
+ +flore
+ +arthur
+ +zephir
+ +some
+ +less
+ +conflict
+ +babar
+
+Check conflict during divergence resolution
+-------------------------------------------------
+
+ $ hg up --hidden 'min(desc("More addition"))'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset 867e43582046
+ (hidden revision '867e43582046' was rewritten as: 5bf84d1d71d1)
+ working directory parent is obsolete! (867e43582046)
+ (use 'hg evolve' to update to its successor: 5bf84d1d71d1)
+ $ echo 'gotta break' >> a
+ $ hg amend
+ 2 new content-divergent changesets
+# reamend so that the case is not the first precursor.
+ $ hg amend -m "More addition (2)"
+ $ hg phase 'contentdivergent()'
+ 4: draft
+ 6: draft
+
+ $ glog
+ @ 6:13c1b75640a1@default(draft) bk:[] More addition (2)
+ |
+ | * 4:5bf84d1d71d1@default(draft) bk:[] More addition
+ |/
+ o 0:6569b5a81c7e@default(public) bk:[] root
+
+
+ $ hg evolve -qn --content-divergent
+ hg update -c 13c1b75640a1 &&
+ hg merge 5bf84d1d71d1 &&
+ hg commit -m "auto merge resolving conflict between 13c1b75640a1 and 5bf84d1d71d1"&&
+ hg up -C 867e43582046 &&
+ hg revert --all --rev tip &&
+ hg commit -m "`hg log -r 13c1b75640a1 --template={desc}`";
+ $ hg evolve --content-divergent
+ merge:[6] More addition (2)
+ with: [4] More addition
+ base: [1] More addition
+ merging "other" content-divergent changeset '5bf84d1d71d1'
+ merging a
+ warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ cat > a <<EOF
+ > jungle
+ > a
+ > flore
+ > arthur
+ > zephir
+ > some
+ > less
+ > conflict
+ > babar
+ > EOF
+
+ $ hg resolve -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+ $ hg evolve --continue
+ working directory is now at 2346e1147fed
+ $ glog
+ @ 7:2346e1147fed@default(draft) bk:[] More addition (2)
+ |
+ o 0:6569b5a81c7e@default(public) bk:[] root
+
+ $ hg exp --config diff.unified=3
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID 2346e1147fedc8c9aa17f9ba7870dcd8be52f567
+ # Parent 6569b5a81c7e307ddc076550e8c0f6d75b6effcd
+ More addition (2)
+
+ diff --git a/a b/a
+ --- a/a
+ +++ b/a
+ @@ -1,1 +1,9 @@
+ +jungle
+ a
+ +flore
+ +arthur
+ +zephir
+ +some
+ +less
+ +conflict
+ +babar
+ $ cd ..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-corner-cases.t Wed Apr 10 14:32:00 2019 +0200
@@ -0,0 +1,321 @@
+========================================================
+Tests the resolution of content divergence: corner cases
+========================================================
+
+This file intend to cover cases that are specific enough to not fit in the
+other cases.
+
+ $ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+ > [defaults]
+ > amend=-d "0 0"
+ > fold=-d "0 0"
+ > [web]
+ > push_ssl = false
+ > allow_push = *
+ > [phases]
+ > publish = False
+ > [diff]
+ > git = 1
+ > unified = 0
+ > [ui]
+ > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n
+ > [extensions]
+ > EOF
+ $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+ $ mkcommit() {
+ > echo "$1" > "$1"
+ > hg add "$1"
+ > hg ci -m "add $1"
+ > }
+
+ $ mkcommits() {
+ > for i in $@; do mkcommit $i ; done
+ > }
+
+Basic test of divergence: two divergent changesets with the same parents
+With --all --any we dedupe the divergent and solve the divergence once
+
+ $ hg init test1
+ $ cd test1
+ $ echo a > a
+ $ hg ci -Aqm "added a"
+ $ echo b > b
+ $ hg ci -Aqm "added b"
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent1
+ $ hg ci -Am "divergent"
+ adding bdivergent1
+ created new head
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent2
+ $ hg ci -Am "divergent"
+ adding bdivergent2
+ created new head
+
+ $ hg prune -s 8374d2ddc3a4 "desc('added b')"
+ 1 changesets pruned
+ $ hg prune -s 593c57f2117e "desc('added b')" --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+ $ hg log -G
+ @ 3:8374d2ddc3a4@default(draft) divergent [content-divergent]
+ |
+ | * 2:593c57f2117e@default(draft) divergent [content-divergent]
+ |/
+ o 0:9092f1db7931@default(draft) added a []
+
+
+ $ hg evolve --all --any --content-divergent
+ merge:[2] divergent
+ with: [3] divergent
+ base: [1] added b
+ updating to "local" side of the conflict: 593c57f2117e
+ merging "other" content-divergent changeset '8374d2ddc3a4'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 45bf1312f454
+ $ hg log -G
+ @ 4:45bf1312f454@default(draft) divergent []
+ |
+ o 0:9092f1db7931@default(draft) added a []
+
+Test divergence resolution when it yields to an empty commit (issue4950)
+cdivergent2 contains the same content than cdivergent1 and they are divergent
+versions of the revision _c
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ mkcommit _c
+ created new head
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ mkcommit cdivergent1
+ created new head
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo "cdivergent1" > cdivergent1
+ $ hg add cdivergent1
+ $ hg ci -m "add _c"
+ created new head
+
+ $ hg log -G
+ @ 7:b2ae71172042@default(draft) add _c []
+ |
+ | o 6:e3ff64ce8d4c@default(draft) add cdivergent1 []
+ |/
+ | o 5:48819a835615@default(draft) add _c []
+ |/
+ | o 4:45bf1312f454@default(draft) divergent []
+ |/
+ o 0:9092f1db7931@default(draft) added a []
+
+
+ $ hg prune -s b2ae71172042 48819a835615
+ 1 changesets pruned
+ $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+ $ hg log -G
+ @ 7:b2ae71172042@default(draft) add _c [content-divergent]
+ |
+ | * 6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent]
+ |/
+ | o 4:45bf1312f454@default(draft) divergent []
+ |/
+ o 0:9092f1db7931@default(draft) added a []
+
+ $ hg evolve --all --any --content-divergent
+ merge:[6] add cdivergent1
+ with: [7] add _c
+ base: [5] add _c
+ updating to "local" side of the conflict: e3ff64ce8d4c
+ merging "other" content-divergent changeset 'b2ae71172042'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ nothing changed
+ working directory is now at e3ff64ce8d4c
+
+ $ cd ..
+
+Test None docstring issue of evolve divergent, which caused hg crush
+
+ $ hg init test2
+ $ cd test2
+ $ mkcommits _a _b
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent11
+ $ hg ci -Am "bdivergent"
+ adding bdivergent11
+ created new head
+
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bdivergent > bdivergent22
+ $ hg ci -Am "bdivergent"
+ adding bdivergent22
+ created new head
+
+ $ hg log -G
+ @ 3:6b096fb45070@default(draft) bdivergent []
+ |
+ | o 2:05a6b6a9e633@default(draft) bdivergent []
+ |/
+ | o 1:37445b16603b@default(draft) add _b []
+ |/
+ o 0:135f39f4bd78@default(draft) add _a []
+
+
+ $ hg prune -s 6b096fb45070 37445b16603b
+ 1 changesets pruned
+ $ hg prune -s 05a6b6a9e633 37445b16603b --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+ $ hg log -G
+ @ 3:6b096fb45070@default(draft) bdivergent [content-divergent]
+ |
+ | * 2:05a6b6a9e633@default(draft) bdivergent [content-divergent]
+ |/
+ o 0:135f39f4bd78@default(draft) add _a []
+
+
+ $ cat >$TESTTMP/test_extension.py << EOF
+ > from mercurial import merge
+ > origupdate = merge.update
+ > def newupdate(*args, **kwargs):
+ > return origupdate(*args, **kwargs)
+ > merge.update = newupdate
+ > EOF
+ $ cat >> $HGRCPATH << EOF
+ > [extensions]
+ > testextension=$TESTTMP/test_extension.py
+ > EOF
+ $ hg evolve --all
+ nothing to evolve on current working copy parent
+ (do you want to use --content-divergent)
+ [2]
+ $ hg evolve --content-divergent
+ merge:[3] bdivergent
+ with: [2] bdivergent
+ base: [1] add _b
+ merging "other" content-divergent changeset '05a6b6a9e633'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 73ff357d3975
+
+ $ cd ..
+
+Test to make sure that evolve don't fall into unrecoverable state (issue6053)
+------------------------------------------------------------------------------
+
+It happened when two divergent csets has different parent (need relocation)
+and resolution parent is obsolete. So this issue triggered when during
+relocation we hit conflicts. So lets make the repo as described.
+
+ $ hg init localside
+ $ cd localside
+ $ for ch in a b c d e; do
+ > echo $ch > $ch;
+ > hg add $ch;
+ > hg ci -m "added "$ch;
+ > done;
+
+ $ hg glog
+ @ 4:8d71eadcc9df added e
+ | () [default] draft
+ o 3:9150fe93bec6 added d
+ | () [default] draft
+ o 2:155349b645be added c
+ | () [default] draft
+ o 1:5f6d8a4bf34a added b
+ | () [default] draft
+ o 0:9092f1db7931 added a
+ () [default] draft
+
+ $ echo ee > e
+ $ hg amend -m "updated e"
+ $ hg up 1 -q
+
+To make sure we hit conflict while relocating
+ $ echo dd > d
+ $ echo ee > e
+ $ hg add d e
+ $ hg ci -m "updated e"
+ created new head
+
+Lets create divergence
+ $ hg prune 4 -s . --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+Making obsolete resolution parent
+ $ hg prune 3
+ 1 changesets pruned
+ 1 new orphan changesets
+
+ $ hg glog
+ @ 6:de4ea3103326 updated e
+ | () [default] draft
+ | * 5:ff6f7cd76a7c updated e
+ | | () [default] draft
+ | x 3:9150fe93bec6 added d
+ | | () [default] draft
+ | o 2:155349b645be added c
+ |/ () [default] draft
+ o 1:5f6d8a4bf34a added b
+ | () [default] draft
+ o 0:9092f1db7931 added a
+ () [default] draft
+
+ $ hg evolve --content-divergent --any
+ merge:[5] updated e
+ with: [6] updated e
+ base: [4] added e
+ rebasing "other" content-divergent changeset de4ea3103326 on 9150fe93bec6
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg diff --no-git --config diff.unified=3
+ diff -r 9150fe93bec6 d
+ --- a/d Thu Jan 01 00:00:00 1970 +0000
+ +++ b/d Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,5 @@
+ +<<<<<<< destination: 9150fe93bec6 - test: added d
+ d
+ +=======
+ +dd
+ +>>>>>>> evolving: de4ea3103326 - test: updated e
+ diff -r 9150fe93bec6 e
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/e Thu Jan 01 00:00:00 1970 +0000
+ @@ -0,0 +1,1 @@
+ +ee
+
+ $ echo dresolved > d
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ evolving 6:de4ea3103326 "updated e"
+ updating to "local" side of the conflict: ff6f7cd76a7c
+ merging "other" content-divergent changeset 'e504bd82de7e'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 83b1664a580f
+
+ $ hg glog -l1
+ @ 8:83b1664a580f updated e
+ | () [default] draft
+ ~
+
+ $ cd ..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-interrupted.t Wed Apr 10 14:32:00 2019 +0200
@@ -0,0 +1,598 @@
+=======================================================
+Tests the resolution of content divergence: interrupted
+=======================================================
+
+This file intend to cover case where evolve has to be interrupted.
+
+This test aims at gather test case for --abort, --continue and --stop
+
+
+Tests for the --abort flag for `hg evolve` command while content-divergence resolution
+======================================================================================
+
+The `--abort` flag aborts the interrupted 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 content-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 content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+ $ echo bar > d
+ $ hg amend
+
+ $ hg up c41c793e0ef1 --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset c41c793e0ef1
+ (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+ working directory parent is obsolete! (c41c793e0ef1)
+ (use 'hg evolve' to update to its successor: e49523854bc8)
+
+ $ echo foobar > d
+ $ hg amend
+ 2 new content-divergent changesets
+ $ hg glog --hidden
+ @ 6:9c1631e352d9 added d
+ | () draft
+ | * 5:e49523854bc8 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 evolve --content-divergent
+ merge:[6] added d
+ with: [5] added d
+ base: [4] added d
+ merging "other" content-divergent changeset 'e49523854bc8'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg status -v
+ M d
+ # The repository is in an unfinished *evolve* state.
+
+ # Unresolved merge conflicts:
+ #
+ # d
+ #
+ # To mark files as resolved: hg resolve --mark FILE
+
+ # To continue: hg evolve --continue
+ # To abort: hg evolve --abort
+ # To stop: hg evolve --stop
+ # (also see `hg help evolve.interrupted`)
+
+ $ hg parents
+ changeset: 6:9c1631e352d9
+ tag: tip
+ parent: 3:ca1b80f7960a
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ instability: content-divergent
+ summary: added d
+
+ changeset: 5:e49523854bc8
+ parent: 3:ca1b80f7960a
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ instability: content-divergent
+ summary: added d
+
+
+ $ hg evolve --abort
+ evolve aborted
+ working directory is now at 9c1631e352d9
+
+ $ hg glog --hidden
+ @ 6:9c1631e352d9 added d
+ | () draft
+ | * 5:e49523854bc8 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
+
+Creating multiple content-divergence where resolution of last one results in
+conflicts and resolution of first one resulted in no new commit
+-----------------------------------------------------------------------------
+
+ $ echo watbar > d
+ $ hg amend
+ $ hg up .^
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo bar > c
+ $ hg amend
+ 2 new orphan changesets
+ $ hg up ca1b80f7960a --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory parent is obsolete! (ca1b80f7960a)
+ (use 'hg evolve' to update to its successor: 2ba73e31f264)
+ $ echo foobar > c
+ $ hg amend
+ 2 new content-divergent changesets
+ $ echo bar > c
+ $ hg amend
+
+ $ hg glog --hidden
+ @ 10:491e10505bae added c
+ | () draft
+ | x 9:7398f702a162 added c
+ |/ () draft
+ | * 8:2ba73e31f264 added c
+ |/ () draft
+ | * 7:f0f1694f123e added d
+ | | () draft
+ | | x 6:9c1631e352d9 added d
+ | |/ () draft
+ | | * 5:e49523854bc8 added d
+ | |/ () draft
+ | | x 4:c41c793e0ef1 added d
+ | |/ () draft
+ | x 3:ca1b80f7960a added c
+ |/ () draft
+ o 2:b1661037fa25 added b
+ | () draft
+ o 1:c7586e2a9264 added a
+ | () draft
+ o 0:8fa14d15e168 added hgignore
+ () draft
+
+ $ hg evolve --all --content-divergent
+ merge:[8] added c
+ with: [10] added c
+ base: [3] added c
+ updating to "local" side of the conflict: 2ba73e31f264
+ merging "other" content-divergent changeset '491e10505bae'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ merge:[5] added d
+ with: [7] added d
+ base: [4] added d
+ updating to "local" side of the conflict: e49523854bc8
+ merging "other" content-divergent changeset 'f0f1694f123e'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg evolve --abort
+ 2 new content-divergent changesets
+ evolve aborted
+ working directory is now at 491e10505bae
+
+ $ hg glog --hidden
+ @ 10:491e10505bae added c
+ | () draft
+ | x 9:7398f702a162 added c
+ |/ () draft
+ | * 8:2ba73e31f264 added c
+ |/ () draft
+ | * 7:f0f1694f123e added d
+ | | () draft
+ | | x 6:9c1631e352d9 added d
+ | |/ () draft
+ | | * 5:e49523854bc8 added d
+ | |/ () draft
+ | | x 4:c41c793e0ef1 added d
+ | |/ () draft
+ | x 3:ca1b80f7960a added c
+ |/ () draft
+ o 2:b1661037fa25 added b
+ | () draft
+ o 1:c7586e2a9264 added a
+ | () draft
+ o 0:8fa14d15e168 added hgignore
+ () draft
+
+ $ hg obslog -r . --all
+ * 2ba73e31f264 (8) added c
+ |
+ | @ 491e10505bae (10) added c
+ | |
+ | x 7398f702a162 (9) added c
+ |/ rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ |
+ x ca1b80f7960a (3) added c
+ rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+
+ $ cd ..
+
+Creating content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and relocating leads to conflicts
+---------------------------------------------------------------------------------
+
+ $ hg init multiparent
+ $ cd multiparent
+ $ 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
+
+ $ hg rebase -r . -d .^^^ --config extensions.rebase=
+ rebasing 4:c41c793e0ef1 "added d" (tip)
+ $ echo bar > c
+ $ hg add c
+ $ hg amend
+
+ $ hg up --hidden c41c793e0ef1
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset c41c793e0ef1
+ (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
+ working directory parent is obsolete! (c41c793e0ef1)
+ (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
+ $ echo bar > d
+ $ hg amend
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 7:e49523854bc8 added d
+ | () draft
+ | * 6:69bdd23a9b0d 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 evolve --content-divergent
+ merge:[7] added d
+ with: [6] added d
+ base: [4] added d
+ rebasing "other" content-divergent changeset 69bdd23a9b0d on 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 e49523854bc8
+
+ $ hg glog
+ @ 7:e49523854bc8 added d
+ | () draft
+ | * 6:69bdd23a9b0d 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 content-divergence on multiple parents when gca of divergent changesets
+is parent of one of the divergents and merging divergent leads to conflicts
+---------------------------------------------------------------------------------
+
+ $ hg up 69bdd23a9b0d
+ 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg rm c
+ $ echo wat > d
+ $ hg amend
+
+ $ hg glog
+ @ 8:33e4442acf98 added d
+ | () draft
+ | * 7:e49523854bc8 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 evolve --content-divergent
+ merge:[7] added d
+ with: [8] added d
+ base: [4] added d
+ rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
+ updating to "local" side of the conflict: e49523854bc8
+ merging "other" content-divergent changeset 'a663d1567f0b'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg evolve --abort
+ evolve aborted
+ working directory is now at 33e4442acf98
+
+ $ hg glog
+ @ 8:33e4442acf98 added d
+ | () draft
+ | * 7:e49523854bc8 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
+ $ cd ..
+
+Tests for the --stop flag for `hg evolve` command while resolving content-divergence
+==================================================================================
+
+The `--stop` flag stops the interrupted evolution and delete the state file so
+user can do other things and comeback and do evolution later on
+
+This is testing cases when `hg evolve` command is doing content-divergence resolution.
+
+Setup
+=====
+
+ $ hg init stoprepo
+ $ cd stoprepo
+ $ 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 content divergence, resolution of which will lead to conflicts
+-----------------------------------------------------------------------
+
+ $ echo bar > d
+ $ hg amend
+
+ $ hg up c41c793e0ef1 --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset c41c793e0ef1
+ (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
+ working directory parent is obsolete! (c41c793e0ef1)
+ (use 'hg evolve' to update to its successor: e49523854bc8)
+
+ $ echo foobar > d
+ $ hg amend
+ 2 new content-divergent changesets
+ $ hg glog --hidden
+ @ 6:9c1631e352d9 added d
+ | () draft
+ | * 5:e49523854bc8 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 evolve --content-divergent
+ merge:[6] added d
+ with: [5] added d
+ base: [4] added d
+ merging "other" content-divergent changeset 'e49523854bc8'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg evolve --stop
+ stopped the interrupted evolve
+ working directory is now at 9c1631e352d9
+
+ $ hg glog --hidden
+ @ 6:9c1631e352d9 added d
+ | () draft
+ | * 5:e49523854bc8 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
+
+Content divergence with parent change which will result in conflicts while
+merging
+---------------------------------------------------------------------------
+
+ $ hg rebase -r . -d .^^^ --config extensions.rebase=
+ rebasing 6:9c1631e352d9 "added d" (tip)
+
+ $ hg glog
+ @ 7:517d4375cb72 added d
+ | () draft
+ | * 5:e49523854bc8 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 evolve --content-divergent
+ merge:[5] added d
+ with: [7] added d
+ base: [4] added d
+ rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
+ updating to "local" side of the conflict: e49523854bc8
+ merging "other" content-divergent changeset '606ad96040fc'
+ merging d
+ warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+ 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg evolve --stop
+ stopped the interrupted evolve
+ working directory is now at 517d4375cb72
+
+ $ hg glog
+ @ 7:517d4375cb72 added d
+ | () draft
+ | * 5:e49523854bc8 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
+
+Content-divergence with parent-change which will result in conflicts while
+relocation
+---------------------------------------------------------------------------
+
+ $ echo babar > c
+ $ hg add c
+ $ hg amend
+ $ hg glog
+ @ 8:8fd1c4bd144c added d
+ | () draft
+ | * 5:e49523854bc8 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 evolve --content-divergent
+ merge:[5] added d
+ with: [8] added d
+ base: [4] added d
+ rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
+ merging c
+ warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg diff
+ diff -r ca1b80f7960a c
+ --- a/c Thu Jan 01 00:00:00 1970 +0000
+ +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,5 @@
+ +<<<<<<< destination: ca1b80f7960a - test: added c
+ foo
+ +=======
+ +babar
+ +>>>>>>> evolving: 8fd1c4bd144c - test: added d
+ diff -r ca1b80f7960a d
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/d Thu Jan 01 00:00:00 1970 +0000
+ @@ -0,0 +1,1 @@
+ +foobar
+
+ $ hg evolve --stop
+ stopped the interrupted evolve
+ working directory is now at ca1b80f7960a
+
+XXX: we should have preserved the wdir to be at rev 8
+ $ hg glog
+ * 8:8fd1c4bd144c added d
+ | () draft
+ | * 5:e49523854bc8 added d
+ | | () draft
+ | @ 3:ca1b80f7960a added c
+ | | () draft
+ | o 2:b1661037fa25 added b
+ |/ () draft
+ o 1:c7586e2a9264 added a
+ | () draft
+ o 0:8fa14d15e168 added hgignore
+ () draft
+ $ cd ..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-relocation.t Wed Apr 10 14:32:00 2019 +0200
@@ -0,0 +1,493 @@
+======================================================
+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
+ updating to "local" side of the conflict: 7ed0642d644b
+ merging "other" content-divergent changeset '11f849d7159f'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 171614c9a791
+
+ $ hg glog
+ @ 8:171614c9a791 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 171614c9a7914c53f531373b95632323fdbbac8d
+ # Parent c7586e2a92645e473645847a7b69a6dc52be4276
+ added b
+
+ diff -r c7586e2a9264 -r 171614c9a791 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
+
+Resolving orphans to get back to a normal graph
+
+ $ hg evolve --all
+ move:[3] added c
+ atop:[8] added b
+ move:[4] added d
+ working directory is now at 4ae4427ee9f8
+ $ hg glog
+ @ 10:4ae4427ee9f8 added d
+ | () [default] draft
+ o 9:917281f93fcb added c
+ | () [default] draft
+ o 8:171614c9a791 added b
+ | () [default] draft
+ o 1:c7586e2a9264 added a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+More testing!
+
+ $ hg up .^^
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo x > x
+ $ hg ci -Aqm "added x"
+ $ hg glog -r .
+ @ 11:71a392c714b5 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 71a392c714b5 --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset 71a392c714b5
+ (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d)
+ working directory parent is obsolete! (71a392c714b5)
+ (use 'hg evolve' to update to its successor: 1e1a50385a7d)
+ $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True
+ rebasing 11:71a392c714b5 "added x"
+ 2 new content-divergent changesets
+
+ $ hg glog
+ @ 13:1e4f6b3bb39b added x
+ | () [default] draft
+ | * 12:1e1a50385a7d added foo to x
+ | | () [bar] draft
+ o | 10:4ae4427ee9f8 added d
+ | | () [default] draft
+ o | 9:917281f93fcb added c
+ |/ () [default] draft
+ o 8:171614c9a791 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 1e1a50385a7d on 4ae4427ee9f8
+ updating to "local" side of the conflict: 1e4f6b3bb39b
+ merging "other" content-divergent changeset '80cc9b1ec650'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at b006cf317e0e
+
+ $ hg exp
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Branch bar
+ # Node ID b006cf317e0ed16dbe786c439577475580f645f1
+ # Parent 4ae4427ee9f8f0935211fd66360948b77ab5aee9
+ added foo to x
+
+ diff -r 4ae4427ee9f8 -r b006cf317e0e 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:b006cf317e0e added foo to x
+ | () [bar] draft
+ o 10:4ae4427ee9f8 added d
+ | () [default] draft
+ o 9:917281f93fcb added c
+ | () [default] draft
+ o 8:171614c9a791 added b
+ | () [default] draft
+ o 1:c7586e2a9264 added a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+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:fc6ad2bac162 added y
+ | () [default] draft
+ ~
+
+ $ echo bar > y
+ $ hg amend
+
+ $ hg up fc6ad2bac162 --hidden
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ updated to hidden changeset fc6ad2bac162
+ (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba)
+ working directory parent is obsolete! (fc6ad2bac162)
+ (use 'hg evolve' to update to its successor: 2a9f6ccbdeba)
+ $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True
+ rebasing 16:fc6ad2bac162 "added y"
+ 2 new content-divergent changesets
+ $ echo wat > y
+ $ hg amend
+
+ $ hg glog
+ @ 19:b4575ed6fcfc added y
+ | () [bar] draft
+ | * 17:2a9f6ccbdeba added y
+ | | () [default] draft
+ o | 15:b006cf317e0e added foo to x
+ | | () [bar] draft
+ o | 10:4ae4427ee9f8 added d
+ | | () [default] draft
+ o | 9:917281f93fcb added c
+ |/ () [default] draft
+ o 8:171614c9a791 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 2a9f6ccbdeba on b006cf317e0e
+ updating to "local" side of the conflict: b4575ed6fcfc
+ merging "other" content-divergent changeset '48f745db3f53'
+ 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
+ fix conflicts and 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 7bbcf24ddecf
+
+ $ hg glog
+ @ 21:7bbcf24ddecf added y
+ | () [bar] draft
+ o 15:b006cf317e0e added foo to x
+ | () [bar] draft
+ o 10:4ae4427ee9f8 added d
+ | () [default] draft
+ o 9:917281f93fcb added c
+ | () [default] draft
+ o 8:171614c9a791 added b
+ | () [default] draft
+ o 1:c7586e2a9264 added a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+ $ hg obslog -r . --all
+ @ 7bbcf24ddecf (21) added y
+ |\
+ x | 48f745db3f53 (20) added y
+ | | rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ | |
+ | x b4575ed6fcfc (19) added y
+ | | rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ | |
+ x | 2a9f6ccbdeba (17) added y
+ | | rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+ | |
+ | x 96b677f01b81 (18) added y
+ |/ rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ |
+ x fc6ad2bac162 (16) added y
+ rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+
+
+checking that relocated commit is there
+ $ hg exp 48f745db3f53 --hidden
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3
+ # Parent b006cf317e0ed16dbe786c439577475580f645f1
+ added y
+
+ diff -r b006cf317e0e -r 48f745db3f53 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 wont
+----------------------------------------------------------------------
+
+ $ hg glog
+ @ 21:7bbcf24ddecf added y
+ | () [bar] draft
+ o 15:b006cf317e0e added foo to x
+ | () [bar] draft
+ o 10:4ae4427ee9f8 added d
+ | () [default] draft
+ o 9:917281f93fcb added c
+ | () [default] draft
+ o 8:171614c9a791 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:daf1de08f3b0 added z
+ | () [default] draft
+ ~
+
+ $ echo foo > y
+ $ hg add y
+ $ hg amend
+
+ $ hg up daf1de08f3b0 --hidden
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ updated to hidden changeset daf1de08f3b0
+ (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080)
+ working directory parent is obsolete! (daf1de08f3b0)
+ (use 'hg evolve' to update to its successor: 3f7a1f693080)
+ $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True
+ rebasing 22:daf1de08f3b0 "added z"
+ 2 new content-divergent changesets
+ $ echo bar > z
+ $ hg amend
+
+ $ hg glog
+ @ 25:53242575ffa9 added z
+ | () [bar] draft
+ | * 23:3f7a1f693080 added z
+ | | () [default] draft
+ o | 21:7bbcf24ddecf added y
+ | | () [bar] draft
+ o | 15:b006cf317e0e added foo to x
+ | | () [bar] draft
+ o | 10:4ae4427ee9f8 added d
+ | | () [default] draft
+ o | 9:917281f93fcb added c
+ |/ () [default] draft
+ o 8:171614c9a791 added b
+ | () [default] draft
+ o 1:c7586e2a9264 added a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+ $ hg evolve --content-divergent
+ merge:[25] added z
+ with: [23] added z
+ base: [22] added z
+ rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf
+ merging y
+ warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg diff
+ diff -r 7bbcf24ddecf 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: 7bbcf24ddecf bar - test: added y
+ watbar
+ +=======
+ +foo
+ +>>>>>>> evolving: 3f7a1f693080 - test: added z
+ diff -r 7bbcf24ddecf 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:3f7a1f693080 "added z"
+ updating to "local" side of the conflict: 53242575ffa9
+ merging "other" content-divergent changeset 'cdb0643c69fc'
+ 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
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg diff
+ diff -r 53242575ffa9 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: 53242575ffa9 bar - test: added z
+ watbar
+ +=======
+ +foo
+ +>>>>>>> other: cdb0643c69fc - 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 6fc7d9682de6
+
+ $ hg glog
+ @ 27:6fc7d9682de6 added z
+ | () [bar] draft
+ o 21:7bbcf24ddecf added y
+ | () [bar] draft
+ o 15:b006cf317e0e added foo to x
+ | () [bar] draft
+ o 10:4ae4427ee9f8 added d
+ | () [default] draft
+ o 9:917281f93fcb added c
+ | () [default] draft
+ o 8:171614c9a791 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 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4
+ # Parent 7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b
+ added z
+
+ diff -r 7bbcf24ddecf -r 6fc7d9682de6 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 7bbcf24ddecf -r 6fc7d9682de6 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
+
+ $ cd ..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-content-divergent-stack.t Wed Apr 10 14:32:00 2019 +0200
@@ -0,0 +1,182 @@
+=================================================
+Tests the resolution of content divergence: stack
+=================================================
+
+This file intend to cover case with stacks of divergent changesets
+
+ $ 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
+
+Resolving content-divergence of a stack with same parents
+---------------------------------------------------------
+
+ $ hg init stacktest
+ $ cd stacktest
+ $ 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
+
+ $ cd ..
+ $ hg init stack2
+ $ cd stack2
+ $ hg pull ../stacktest
+ pulling from ../stacktest
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 5 changesets with 5 changes to 5 files
+ new changesets 8fa14d15e168:c41c793e0ef1 (5 drafts)
+ (run 'hg update' to get a working copy)
+ $ hg glog
+ o 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 c7586e2a9264
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo bar > a
+ $ hg amend -m "watbar to a"
+ 3 new orphan changesets
+ $ echo wat > a
+ $ hg amend -m "watbar to a"
+ $ hg evolve --all
+ move:[2] added b
+ atop:[6] watbar to a
+ move:[3] added c
+ move:[4] added d
+ working directory is now at 15c781f93cac
+ $ hg glog
+ @ 9:15c781f93cac added d
+ | () [default] draft
+ o 8:9e5fb1d5b955 added c
+ | () [default] draft
+ o 7:88516dccf68a added b
+ | () [default] draft
+ o 6:82b74d5dc678 watbar to a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+ $ cd ../stacktest
+ $ hg up .^^^
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ $ echo wat > a
+ $ hg amend -m "watbar to a"
+ 3 new orphan changesets
+ $ hg evolve --all
+ move:[2] added b
+ atop:[5] watbar to a
+ move:[3] added c
+ move:[4] added d
+ working directory is now at c72d2885eb51
+ $ hg glog
+ @ 8:c72d2885eb51 added d
+ | () [default] draft
+ o 7:3ce4be6d8e5e added c
+ | () [default] draft
+ o 6:d5f148423c16 added b
+ | () [default] draft
+ o 5:8e222f257bbf watbar to a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+ $ hg pull ../stack2
+ pulling from ../stack2
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 4 changesets with 0 changes to 4 files (+1 heads)
+ 5 new obsolescence markers
+ 8 new content-divergent changesets
+ new changesets 82b74d5dc678:15c781f93cac (4 drafts)
+ (run 'hg heads' to see heads, 'hg merge' to merge)
+
+ $ hg glog
+ * 12:15c781f93cac added d
+ | () [default] draft
+ * 11:9e5fb1d5b955 added c
+ | () [default] draft
+ * 10:88516dccf68a added b
+ | () [default] draft
+ * 9:82b74d5dc678 watbar to a
+ | () [default] draft
+ | @ 8:c72d2885eb51 added d
+ | | () [default] draft
+ | * 7:3ce4be6d8e5e added c
+ | | () [default] draft
+ | * 6:d5f148423c16 added b
+ | | () [default] draft
+ | * 5:8e222f257bbf watbar to a
+ |/ () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
+
+ $ hg evolve --all --content-divergent
+ merge:[5] watbar to a
+ with: [9] watbar to a
+ base: [1] added a
+ updating to "local" side of the conflict: 8e222f257bbf
+ merging "other" content-divergent changeset '82b74d5dc678'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 6 new orphan changesets
+ merge:[6] added b
+ with: [10] added b
+ base: [2] added b
+ updating to "local" side of the conflict: d5f148423c16
+ merging "other" content-divergent changeset '88516dccf68a'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ merge:[7] added c
+ with: [11] added c
+ base: [3] added c
+ updating to "local" side of the conflict: 3ce4be6d8e5e
+ merging "other" content-divergent changeset '9e5fb1d5b955'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ merge:[8] added d
+ with: [12] added d
+ base: [4] added d
+ updating to "local" side of the conflict: c72d2885eb51
+ merging "other" content-divergent changeset '15c781f93cac'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at 038fe7db3d88
+
+ $ hg glog
+ @ 16:038fe7db3d88 added d
+ | () [default] draft
+ o 15:b2cac10f3836 added c
+ | () [default] draft
+ o 14:eadfd9d70680 added b
+ | () [default] draft
+ o 13:f66f262fff6c watbar to a
+ | () [default] draft
+ o 0:8fa14d15e168 added hgignore
+ () [default] draft
--- a/tests/test-evolve-stop-contentdiv.t Tue Apr 09 21:16:49 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-Tests for the --stop flag for `hg evolve` command while resolving content-divergence
-==================================================================================
-
-The `--stop` flag stops the interrupted evolution and delete the state file so
-user can do other things and comeback and do evolution later on
-
-This is testing cases when `hg evolve` command is doing content-divergence resolution.
-
-Setup
-=====
-
- $ cat >> $HGRCPATH <<EOF
- > [alias]
- > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
- > [extensions]
- > EOF
- $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
-
- $ hg init stoprepo
- $ cd stoprepo
- $ 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 content divergence, resolution of which will lead to conflicts
------------------------------------------------------------------------
-
- $ echo bar > d
- $ hg amend
-
- $ hg up c41c793e0ef1 --hidden
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset c41c793e0ef1
- (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
- working directory parent is obsolete! (c41c793e0ef1)
- (use 'hg evolve' to update to its successor: e49523854bc8)
-
- $ echo foobar > d
- $ hg amend
- 2 new content-divergent changesets
- $ hg glog --hidden
- @ 6:9c1631e352d9 added d
- | () draft
- | * 5:e49523854bc8 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 evolve --content-divergent
- merge:[6] added d
- with: [5] added d
- base: [4] added d
- merging "other" content-divergent changeset 'e49523854bc8'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg evolve --stop
- stopped the interrupted evolve
- working directory is now at 9c1631e352d9
-
- $ hg glog --hidden
- @ 6:9c1631e352d9 added d
- | () draft
- | * 5:e49523854bc8 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
-
-Content divergence with parent change which will result in conflicts while
-merging
----------------------------------------------------------------------------
-
- $ hg rebase -r . -d .^^^ --config extensions.rebase=
- rebasing 6:9c1631e352d9 "added d" (tip)
-
- $ hg glog
- @ 7:517d4375cb72 added d
- | () draft
- | * 5:e49523854bc8 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 evolve --content-divergent
- merge:[5] added d
- with: [7] added d
- base: [4] added d
- rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
- updating to "local" side of the conflict: e49523854bc8
- merging "other" content-divergent changeset '606ad96040fc'
- merging d
- warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg evolve --stop
- stopped the interrupted evolve
- working directory is now at 517d4375cb72
-
- $ hg glog
- @ 7:517d4375cb72 added d
- | () draft
- | * 5:e49523854bc8 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
-
-Content-divergence with parent-change which will result in conflicts while
-relocation
----------------------------------------------------------------------------
-
- $ echo babar > c
- $ hg add c
- $ hg amend
- $ hg glog
- @ 8:8fd1c4bd144c added d
- | () draft
- | * 5:e49523854bc8 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 evolve --content-divergent
- merge:[5] added d
- with: [8] added d
- base: [4] added d
- rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
- merging c
- warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ hg diff
- diff -r ca1b80f7960a c
- --- a/c Thu Jan 01 00:00:00 1970 +0000
- +++ b/c Thu Jan 01 00:00:00 1970 +0000
- @@ -1,1 +1,5 @@
- +<<<<<<< destination: ca1b80f7960a - test: added c
- foo
- +=======
- +babar
- +>>>>>>> evolving: 8fd1c4bd144c - test: added d
- diff -r ca1b80f7960a d
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/d Thu Jan 01 00:00:00 1970 +0000
- @@ -0,0 +1,1 @@
- +foobar
-
- $ hg evolve --stop
- stopped the interrupted evolve
- working directory is now at ca1b80f7960a
-
-XXX: we should have preserved the wdir to be at rev 8
- $ hg glog
- * 8:8fd1c4bd144c added d
- | () draft
- | * 5:e49523854bc8 added d
- | | () draft
- | @ 3:ca1b80f7960a added c
- | | () draft
- | o 2:b1661037fa25 added b
- |/ () draft
- o 1:c7586e2a9264 added a
- | () draft
- o 0:8fa14d15e168 added hgignore
- () draft
--- a/tests/test-sharing.t Tue Apr 09 21:16:49 2019 +0200
+++ b/tests/test-sharing.t Wed Apr 10 14:32:00 2019 +0200
@@ -423,7 +423,7 @@
~
$ cd ..
-Setup for "cowboy mode" shared mutable history (to illustrate divergent
+Setup for shared mutable history (to illustrate divergent
and bumped changesets).
$ rm -rf review alice bob
$ hg clone public alice
@@ -446,8 +446,7 @@
$ hg shortlog -r .
4:2fe6c4bd32d0 draft fix bug 24 (v1)
-Since Alice and Bob are now in cowboy mode, Alice pulls Bob's draft
-changeset and amends it herself. ::
+Alice pulls Bob's draft changeset and amends it herself. ::
$ cd ../alice
$ hg pull -u ../bob
--- a/tests/test-stabilize-result.t Tue Apr 09 21:16:49 2019 +0200
+++ b/tests/test-stabilize-result.t Wed Apr 10 14:32:00 2019 +0200
@@ -204,243 +204,3 @@
a
newer a
+babar
-
-Stabilize divergent changesets with same parent
-===============================================
-
- $ rm a.orig
- $ hg up 7bc2f5967f5e
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cat << EOF >> a
- > flore
- > arthur
- > zephir
- > some
- > less
- > conflict
- > EOF
- $ hg ci -m 'More addition'
- $ glog
- @ 12:3932c176bbaa@default(draft) bk:[] More addition
- |
- | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
- | |
- o | 7:7bc2f5967f5e@default(draft) bk:[] add c
- | |
- | o 6:1cf0aacfd363@default(public) bk:[] newer a
- |/
- o 5:66719795a494@default(public) bk:[changea] changea
- |
- o 0:07f494440405@default(public) bk:[] adda
-
- $ echo 'babar' >> a
- $ hg amend
- $ hg up --hidden 3932c176bbaa
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset 3932c176bbaa
- (hidden revision '3932c176bbaa' was rewritten as: d2f173e25686)
- working directory parent is obsolete! (3932c176bbaa)
- (use 'hg evolve' to update to its successor: d2f173e25686)
- $ mv a a.old
- $ echo 'jungle' > a
- $ cat a.old >> a
- $ rm a.old
- $ hg amend
- 2 new content-divergent changesets
- $ glog
- @ 14:eacc9c8240fe@default(draft) bk:[] More addition
- |
- | * 13:d2f173e25686@default(draft) bk:[] More addition
- |/
- | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
- | |
- o | 7:7bc2f5967f5e@default(draft) bk:[] add c
- | |
- | o 6:1cf0aacfd363@default(public) bk:[] newer a
- |/
- o 5:66719795a494@default(public) bk:[changea] changea
- |
- o 0:07f494440405@default(public) bk:[] adda
-
-
-Stabilize it
-
- $ hg evolve -qn --confirm --content-divergent
- merge:[14] More addition
- with: [13] More addition
- base: [12] More addition
- perform evolve? [Ny] n
- abort: evolve aborted by user
- [255]
- $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
- merge:[14] More addition
- with: [13] More addition
- base: [12] More addition
- perform evolve? [Ny] y
- hg update -c eacc9c8240fe &&
- hg merge d2f173e25686 &&
- hg commit -m "auto merge resolving conflict between eacc9c8240fe and d2f173e25686"&&
- hg up -C 3932c176bbaa &&
- hg revert --all --rev tip &&
- hg commit -m "`hg log -r eacc9c8240fe --template={desc}`";
- $ hg evolve -v --content-divergent
- merge:[14] More addition
- with: [13] More addition
- base: [12] More addition
- merging "other" content-divergent changeset 'd2f173e25686'
- resolving manifests
- merging a
- 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
- committing files:
- a
- committing manifest
- committing changelog
- working directory is now at 4d6ed26797bc
- $ hg st
- $ glog
- @ 15:4d6ed26797bc@default(draft) bk:[] More addition
- |
- | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
- | |
- o | 7:7bc2f5967f5e@default(draft) bk:[] add c
- | |
- | o 6:1cf0aacfd363@default(public) bk:[] newer a
- |/
- o 5:66719795a494@default(public) bk:[changea] changea
- |
- o 0:07f494440405@default(public) bk:[] adda
-
- $ hg summary
- parent: 15:4d6ed26797bc tip
- More addition
- branch: default
- commit: (clean)
- update: 2 new changesets, 2 branch heads (merge)
- phases: 3 draft
- $ hg export .
- # HG changeset patch
- # User test
- # Date 0 0
- # Thu Jan 01 00:00:00 1970 +0000
- # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
- # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
- More addition
-
- diff -r 7bc2f5967f5e -r 4d6ed26797bc a
- --- a/a Thu Jan 01 00:00:00 1970 +0000
- +++ b/a Thu Jan 01 00:00:00 1970 +0000
- @@ -1,1 +1,9 @@
- +jungle
- a
- +flore
- +arthur
- +zephir
- +some
- +less
- +conflict
- +babar
-
-Check conflict during divergence resolution
--------------------------------------------------
-
- $ hg up --hidden 3932c176bbaa
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- updated to hidden changeset 3932c176bbaa
- (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc)
- working directory parent is obsolete! (3932c176bbaa)
- (use 'hg evolve' to update to its successor: 4d6ed26797bc)
- $ echo 'gotta break' >> a
- $ hg amend
- 2 new content-divergent changesets
-# reamend so that the case is not the first precursor.
- $ hg amend -m "More addition (2)"
- $ hg phase 'contentdivergent()'
- 15: draft
- 17: draft
-
- $ glog
- @ 17:0b336205a5d0@default(draft) bk:[] More addition (2)
- |
- | * 15:4d6ed26797bc@default(draft) bk:[] More addition
- |/
- | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
- | |
- o | 7:7bc2f5967f5e@default(draft) bk:[] add c
- | |
- | o 6:1cf0aacfd363@default(public) bk:[] newer a
- |/
- o 5:66719795a494@default(public) bk:[changea] changea
- |
- o 0:07f494440405@default(public) bk:[] adda
-
-
- $ hg evolve -qn --content-divergent
- hg update -c 0b336205a5d0 &&
- hg merge 4d6ed26797bc &&
- hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
- hg up -C 3932c176bbaa &&
- hg revert --all --rev tip &&
- hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
- $ hg evolve --content-divergent
- merge:[17] More addition (2)
- with: [15] More addition
- base: [12] More addition
- merging "other" content-divergent changeset '4d6ed26797bc'
- merging a
- warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
- 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
- fix conflicts and see `hg help evolve.interrupted`
- [1]
-
- $ cat > a <<EOF
- > jungle
- > a
- > flore
- > arthur
- > zephir
- > some
- > less
- > conflict
- > babar
- > EOF
-
- $ hg resolve -m
- (no more unresolved files)
- continue: hg evolve --continue
- $ hg evolve --continue
- working directory is now at e8746835a2a1
- $ glog
- @ 18:e8746835a2a1@default(draft) bk:[] More addition (2)
- |
- | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
- | |
- o | 7:7bc2f5967f5e@default(draft) bk:[] add c
- | |
- | o 6:1cf0aacfd363@default(public) bk:[] newer a
- |/
- o 5:66719795a494@default(public) bk:[changea] changea
- |
- o 0:07f494440405@default(public) bk:[] adda
-
- $ hg exp
- # HG changeset patch
- # User test
- # Date 0 0
- # Thu Jan 01 00:00:00 1970 +0000
- # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
- # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
- More addition (2)
-
- diff -r 7bc2f5967f5e -r e8746835a2a1 a
- --- a/a Thu Jan 01 00:00:00 1970 +0000
- +++ b/a Thu Jan 01 00:00:00 1970 +0000
- @@ -1,1 +1,9 @@
- +jungle
- a
- +flore
- +arthur
- +zephir
- +some
- +less
- +conflict
- +babar