--- a/hgext3rd/evolve/evolvecmd.py Fri Mar 29 15:15:07 2019 +0100
+++ b/hgext3rd/evolve/evolvecmd.py Fri Apr 05 17:45:59 2019 +0200
@@ -579,12 +579,13 @@
(TROUBLES['CONTENTDIVERGENT'], other.hex()[:12]))
if progresscb:
progresscb()
+ mergeancestor = repo.changelog.isancestor(divergent.node(), other.node())
stats = merge.update(repo,
other.node(),
branchmerge=True,
force=False,
ancestor=base.node(),
- mergeancestor=True)
+ mergeancestor=mergeancestor)
hg._showstats(repo, stats)
# conflicts while merging content-divergent changesets
--- a/tests/test-evolve-public-content-divergent.t Fri Mar 29 15:15:07 2019 +0100
+++ b/tests/test-evolve-public-content-divergent.t Fri Apr 05 17:45:59 2019 +0200
@@ -502,14 +502,14 @@
o 0:9092f1db7931 added a
draft
- $ hg prune 3 -s 5
+ $ hg prune 'min(desc("re:added d$"))' -s 'max(desc("re:added d$"))'
1 changesets pruned
- $ hg prune 3 -s 4 --hidden
+ $ hg prune 'min(desc("re:added d$"))' -s 'desc("added d c e")' --hidden
1 changesets pruned
2 new content-divergent changesets
Change phase to public for one head:
- $ hg phase --public -r 5
+ $ hg phase --public -r 'max(desc("re:added d$"))'
$ hg glog
@ 5:93cd84bbdaca added d
@@ -811,6 +811,287 @@
$ hg evolve -l
$ cd ..
+Different parent, simple conflict on relocate, deleted file on actual merge
+---------------------------------------------------------------------------
+
+Changeset "added c e" is also removing 'd'. This should conflict with the update
+to 'd' in the successors of 'adding d' when solving the content divergence.
+
+ $ hg init pubdiv-parent-deleted-file
+ $ cd pubdiv-parent-deleted-file
+ $ for ch in a b c d; do
+ > echo $ch > $ch;
+ > hg ci -Aqm "added "$ch;
+ > done;
+
+ $ hg up 'desc("added b")'
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo cfoo > c
+ $ echo e > e
+ $ hg add c e
+ $ hg ci -m "added c e"
+ created new head
+
+ $ hg up 'desc("re:added c$")'
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo dd > d
+ $ hg add d
+ $ hg ci -m "added d"
+ created new head
+
+ $ hg glog --patch --rev 'sort(all(), "topo")'
+ @ 5:93cd84bbdaca added d
+ | draft
+ |
+ | diff -r 155349b645be -r 93cd84bbdaca 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 @@
+ | +dd
+ |
+ | o 3:9150fe93bec6 added d
+ |/ draft
+ |
+ | diff -r 155349b645be -r 9150fe93bec6 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 @@
+ | +d
+ |
+ o 2:155349b645be added c
+ | draft
+ |
+ | diff -r 5f6d8a4bf34a -r 155349b645be c
+ | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -0,0 +1,1 @@
+ | +c
+ |
+ | o 4:e568fd1029bb added c e
+ |/ draft
+ |
+ | diff -r 5f6d8a4bf34a -r e568fd1029bb c
+ | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -0,0 +1,1 @@
+ | +cfoo
+ | diff -r 5f6d8a4bf34a -r e568fd1029bb 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 @@
+ | +e
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ | diff -r 9092f1db7931 -r 5f6d8a4bf34a 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 @@
+ | +b
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+ diff -r 000000000000 -r 9092f1db7931 a
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/a Thu Jan 01 00:00:00 1970 +0000
+ @@ -0,0 +1,1 @@
+ +a
+
+ $ hg prune 'min(desc("added d"))' -s 'max(desc("added d"))'
+ 1 changesets pruned
+ $ hg prune 'min(desc("added d"))' -s 'desc("added c e")' --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+
+Change phase to public for one head:
+ $ hg phase --public -r 'max(desc("added d"))'
+
+ $ hg glog
+ @ 5:93cd84bbdaca added d
+ | public
+ |
+ | * 4:e568fd1029bb added c e
+ | | draft content-divergent
+ | |
+ o | 2:155349b645be added c
+ |/ public
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ o 0:9092f1db7931 added a
+ public
+
+
+ $ hg glog --patch --rev 'sort(all(), "topo")' --hidden
+ @ 5:93cd84bbdaca added d
+ | public
+ |
+ | diff -r 155349b645be -r 93cd84bbdaca 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 @@
+ | +dd
+ |
+ | x 3:9150fe93bec6 added d
+ |/ draft
+ |
+ | diff -r 155349b645be -r 9150fe93bec6 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 @@
+ | +d
+ |
+ o 2:155349b645be added c
+ | public
+ |
+ | diff -r 5f6d8a4bf34a -r 155349b645be c
+ | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -0,0 +1,1 @@
+ | +c
+ |
+ | * 4:e568fd1029bb added c e
+ |/ draft content-divergent
+ |
+ | diff -r 5f6d8a4bf34a -r e568fd1029bb c
+ | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -0,0 +1,1 @@
+ | +cfoo
+ | diff -r 5f6d8a4bf34a -r e568fd1029bb 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 @@
+ | +e
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ | diff -r 9092f1db7931 -r 5f6d8a4bf34a 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 @@
+ | +b
+ |
+ o 0:9092f1db7931 added a
+ public
+
+ diff -r 000000000000 -r 9092f1db7931 a
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/a Thu Jan 01 00:00:00 1970 +0000
+ @@ -0,0 +1,1 @@
+ +a
+
+
+ $ hg obslog --all --rev tip --patch
+ @ 93cd84bbdaca (5) added d
+ |
+ | * e568fd1029bb (4) added c e
+ |/
+ x 9150fe93bec6 (3) added d
+ rewritten(content) as 93cd84bbdaca using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+ diff -r 9150fe93bec6 -r 93cd84bbdaca d
+ --- a/d Thu Jan 01 00:00:00 1970 +0000
+ +++ b/d Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,1 @@
+ -d
+ +dd
+
+ rewritten(description, parent, content) as e568fd1029bb using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+ (No patch available, changesets rebased)
+
+
+ $ hg evolve --content-divergent --any
+ merge:[5] added d
+ with: [4] added c e
+ base: [3] added d
+ rebasing "other" content-divergent changeset e568fd1029bb on 155349b645be
+ 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 155349b645be 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: 155349b645be - test: added c
+ c
+ +=======
+ +cfoo
+ +>>>>>>> evolving: e568fd1029bb - test: added c e
+ diff -r 155349b645be 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 @@
+ +e
+
+ $ echo c > c
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ evolving 4:e568fd1029bb "added c e"
+ updating to "local" side of the conflict: 93cd84bbdaca
+ merging "other" content-divergent changeset '2af3359250d3'
+ file 'd' was deleted in other but was modified in local.
+ What do you want to do?
+ use (c)hanged version, (d)elete, or leave (u)nresolved? u
+ 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ hg sum
+ parent: 5:93cd84bbdaca
+ added d
+ parent: 6:2af3359250d3 tip (content-divergent)
+ added c e
+ branch: default
+ commit: 1 modified, 1 unknown, 1 unresolved (merge)
+ update: (current)
+ phases: 1 draft
+ content-divergent: 1 changesets
+ evolve: (evolve --continue)
+
+ $ echo resolved > d
+ $ hg resolve -m d
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ committed as bc1f4610744c
+ working directory is now at bc1f4610744c
+
+ $ hg export
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID bc1f4610744c6aa0e851d3876a61bfff6243b31c
+ # Parent 93cd84bbdacaeb8f881c29a609dbdd30c38cbc57
+ phase-divergent update to 93cd84bbdaca:
+
+ added c e
+
+ diff -r 93cd84bbdaca -r bc1f4610744c d
+ --- a/d Thu Jan 01 00:00:00 1970 +0000
+ +++ b/d Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,1 @@
+ -dd
+ +resolved
+ diff -r 93cd84bbdaca -r bc1f4610744c 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 @@
+ +e
+
+ $ hg evolve -l
+ $ cd ..
Testing the case when "merging results in same as public cset" where:
both the csets are on same parent and no conflict in merging.