evolve: cover continue case in pubdiv when merging results in same as public
This patch is the part of a series which is adding support of public
divergence resolution of the case when merging results in same as pubic
cset. Changes made in this patch cover the --continue flag for the case:
when we had conflicts in merging.
Modified lines in previously added tests reflects the changed behaviour.
Also added some additional tests. I guess I have covered every possbile
case in test-evolve-public-content-divergent.t
While reviewing, if you see any test missed please let me know.
(I think there is one test missed that I will send as a follow-up)
--- a/hgext3rd/evolve/evolvecmd.py Fri Feb 22 01:02:51 2019 +0530
+++ b/hgext3rd/evolve/evolvecmd.py Thu Feb 28 03:12:39 2019 +0530
@@ -1921,6 +1921,10 @@
if not res:
# no need to proceed for phase divergence resolution step
pass
+ elif newnode == publicnode:
+ # merging had the same changes as public changeset and
+ # divergence has been resolved by creating markers
+ pass
else:
prec = repo[publicnode]
bumped = repo[newnode]
--- a/tests/test-evolve-public-content-divergent.t Fri Feb 22 01:02:51 2019 +0530
+++ b/tests/test-evolve-public-content-divergent.t Thu Feb 28 03:12:39 2019 +0530
@@ -975,17 +975,9 @@
continue: hg evolve --continue
$ hg evolve --continue
- computing new diff
- transaction abort!
- rollback completed
- abort: cannot obsolete public changeset: f7c1071f1e7c
- (see 'hg help phases' for details)
- [255]
+ working directory is now at f7c1071f1e7c
$ hg evolve -l
- 229da2719b19: added ch
- content-divergent: f7c1071f1e7c (public) (precursor 155349b645be)
-
$ hg par
changeset: 4:f7c1071f1e7c
@@ -995,10 +987,334 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: added c
- changeset: 3:229da2719b19
- parent: 1:5f6d8a4bf34a
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and relocation leads to conflict but merging won't.
+------------------------------------------------------------------------------------------
+Prepare the repo:
+
+ $ cd ..
+ $ hg init pubdiv8
+ $ cd pubdiv8
+ $ for ch in a b c d; do
+ > echo $ch > $ch;
+ > hg ci -Am "added "$ch;
+ > done;
+ adding a
+ adding b
+ adding c
+ adding d
+
+ $ hg up 1
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo dh > dh
+ $ echo cc > c
+ $ hg add dh c
+ $ hg ci -m "added dh"
+ created new head
+
+ $ hg up 2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo dh > dh
+ $ hg add dh
+ $ hg ci -m "added d"
+ created new head
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | draft
+ |
+ | o 4:f89a8e2f86ac added dh
+ | | draft
+ | |
+ +---o 3:9150fe93bec6 added d
+ | | draft
+ | |
+ o | 2:155349b645be added c
+ |/ draft
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+
+ $ hg prune 3 -s 4
+ 1 changesets pruned
+ $ hg prune 3 -s 5 --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+ $ hg phase --public -r 5
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | public
+ |
+ | * 4:f89a8e2f86ac added dh
+ | | draft content-divergent
+ | |
+ o | 2:155349b645be added c
+ |/ public
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ o 0:9092f1db7931 added a
+ public
+
+ $ hg evolve --content-divergent --any
+ merge:[5] added d
+ with: [4] added dh
+ base: [3] added d
+ rebasing "other" content-divergent changeset f89a8e2f86ac on 155349b645be
+ merging c
+ warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ echo c > c
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ evolving 4:f89a8e2f86ac "added dh"
+ updating to "local" side of the conflict: e800202333a4
+ merging "other" content-divergent changeset 'bc309da55b88'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ working directory is now at e800202333a4
+
+ $ hg evolve -l
+
+ $ hg par
+ changeset: 5:e800202333a4
+ tag: tip
+ parent: 2:155349b645be
user: test
date: Thu Jan 01 00:00:00 1970 +0000
- instability: content-divergent
- summary: added ch
+ summary: added d
+
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and merging leads to conflict but relocation won't.
+------------------------------------------------------------------------------------------
+Prepare the repo:
+
+ $ cd ..
+ $ hg init pubdiv9
+ $ cd pubdiv9
+ $ for ch in a b c d; do
+ > echo $ch > $ch;
+ > hg ci -Am "added "$ch;
+ > done;
+ adding a
+ adding b
+ adding c
+ adding d
+
+ $ hg up 1
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo dhconflict > dh
+ $ hg add dh
+ $ hg ci -m "added dh"
+ created new head
+
+ $ hg up 2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo dh > dh
+ $ hg add dh
+ $ hg ci -m "added d"
+ created new head
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | draft
+ |
+ | o 4:db0b7bba0aae added dh
+ | | draft
+ | |
+ +---o 3:9150fe93bec6 added d
+ | | draft
+ | |
+ o | 2:155349b645be added c
+ |/ draft
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+
+ $ hg prune 3 -s 4
+ 1 changesets pruned
+ $ hg prune 3 -s 5 --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+ $ hg phase --public -r 5
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | public
+ |
+ | * 4:db0b7bba0aae added dh
+ | | draft content-divergent
+ | |
+ o | 2:155349b645be added c
+ |/ public
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ o 0:9092f1db7931 added a
+ public
+
+ $ hg evolve --content-divergent --any
+ merge:[5] added d
+ with: [4] added dh
+ base: [3] added d
+ rebasing "other" content-divergent changeset db0b7bba0aae on 155349b645be
+ updating to "local" side of the conflict: e800202333a4
+ merging "other" content-divergent changeset 'a5bbf2042450'
+ merging dh
+ warning: conflicts while merging dh! (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 dh > dh
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ working directory is now at e800202333a4
+
+ $ hg evolve -l
+
+ $ hg par
+ changeset: 5:e800202333a4
+ tag: tip
+ parent: 2:155349b645be
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: added d
+
+Testing the case when "merging results in same as public cset" where:
+both the csets are on different parent and relocation and merging both leads to conflict:
+-----------------------------------------------------------------------------------------
+Prepare the repo:
+
+ $ cd ..
+ $ hg init pubdiv10
+ $ cd pubdiv10
+ $ for ch in a b c d; do
+ > echo $ch > $ch;
+ > hg ci -Am "added "$ch;
+ > done;
+ adding a
+ adding b
+ adding c
+ adding d
+
+ $ hg up 1
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo dhconflict > dh
+ $ echo cc > c
+ $ hg add dh c
+ $ hg ci -m "added dh"
+ created new head
+
+ $ hg up 2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo dh > dh
+ $ hg add dh
+ $ hg ci -m "added d"
+ created new head
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | draft
+ |
+ | o 4:67b19bbd770f added dh
+ | | draft
+ | |
+ +---o 3:9150fe93bec6 added d
+ | | draft
+ | |
+ o | 2:155349b645be added c
+ |/ draft
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+
+ $ hg prune 3 -s 4
+ 1 changesets pruned
+ $ hg prune 3 -s 5 --hidden
+ 1 changesets pruned
+ 2 new content-divergent changesets
+ $ hg phase --public -r 5
+
+ $ hg glog
+ @ 5:e800202333a4 added d
+ | public
+ |
+ | * 4:67b19bbd770f added dh
+ | | draft content-divergent
+ | |
+ o | 2:155349b645be added c
+ |/ public
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ o 0:9092f1db7931 added a
+ public
+
+ $ hg evolve --content-divergent --any
+ merge:[5] added d
+ with: [4] added dh
+ base: [3] added d
+ rebasing "other" content-divergent changeset 67b19bbd770f on 155349b645be
+ merging c
+ warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+ fix conflicts and see `hg help evolve.interrupted`
+ [1]
+
+ $ echo c > c
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ evolving 4:67b19bbd770f "added dh"
+ updating to "local" side of the conflict: e800202333a4
+ merging "other" content-divergent changeset '09054d1f3c97'
+ merging dh
+ warning: conflicts while merging dh! (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 dh > dh
+ $ hg res -m
+ (no more unresolved files)
+ continue: hg evolve --continue
+
+ $ hg evolve --continue
+ working directory is now at e800202333a4
+
+ $ hg evolve -l
+
+ $ hg par
+ changeset: 5:e800202333a4
+ tag: tip
+ parent: 2:155349b645be
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: added d
+