branching: merge with stable
There have been multiple fix on stable.
--- a/CHANGELOG Sun Sep 08 21:24:45 2019 +0200
+++ b/CHANGELOG Tue Sep 10 07:38:46 2019 +0200
@@ -14,7 +14,10 @@
9.1.1 - in progress
-------------------
+ * evolve: test that target is not orig in _solveunstable() (issue6097)
+ * fold: check allowdivergence before folding obsolete changesets (issue5817)
* obslog: correct spacing of patch output with word-diff=yes (issue6175)
+ * stack: make sure to preserve dependencies, fixes certain complex cases
9.1.0 -- 2019-07-29
-------------------
--- a/hgext3rd/evolve/cmdrewrite.py Sun Sep 08 21:24:45 2019 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py Tue Sep 10 07:38:46 2019 +0200
@@ -762,6 +762,14 @@
ui.write_err(_(b'single revision specified, nothing to fold\n'))
return 1
+ if not ui.configbool(b'experimental', b'evolution.allowdivergence'):
+ for rev in revs:
+ if repo[rev].obsolete():
+ msg = _(b'folding obsolete revisions may cause divergence')
+ hint = _(b'set experimental.evolution.allowdivergence=yes'
+ b' to allow folding them')
+ raise error.Abort(msg, hint=hint)
+
# Sort so combined commit message of `hg fold --exact -r . -r .^` is
# in topological order.
revs.sort()
--- a/hgext3rd/topic/stack.py Sun Sep 08 21:24:45 2019 +0200
+++ b/hgext3rd/topic/stack.py Tue Sep 10 07:38:46 2019 +0200
@@ -143,9 +143,18 @@
# processed dependency graph.
# Step 1: compute relation of revision with each other
- dependencies, rdependencies = self._dependencies
- dependencies = dependencies.copy()
- rdependencies = rdependencies.copy()
+ origdeps, rdependencies = self._dependencies
+ dependencies = {}
+ # Making a deep copy of origdeps because we modify contents of values
+ # later on. Checking for list here only because right now
+ # builddependencies in evolvebits.py can return a list of _succs()
+ # objects. When that will be dealt with, this deep copy code can be
+ # simplified a lot.
+ for k, v in origdeps.items():
+ if isinstance(v, list):
+ dependencies[k] = [i.copy() for i in v]
+ else:
+ dependencies[k] = v.copy()
# Step 2: Build the ordering
# Remove the revisions with no dependency(A) and add them to the ordering.
# Removing these revisions leads to new revisions with no dependency (the
--- a/tests/test-fold.t Sun Sep 08 21:24:45 2019 +0200
+++ b/tests/test-fold.t Tue Sep 10 07:38:46 2019 +0200
@@ -254,7 +254,8 @@
Test order of proposed commit message
- $ hg fold --exact --hidden -r 4 -r 5 -r 6
+ $ hg fold --exact --hidden -r 4 -r 5 -r 6 \
+ > --config experimental.evolution.allowdivergence=yes
2 new content-divergent changesets
3 changesets folded
$ hg log -r tip -T '{desc}'
@@ -265,7 +266,8 @@
r6 (no-eol)
- $ hg fold --exact --hidden -r 6 -r 4 -r 5
+ $ hg fold --exact --hidden -r 6 -r 4 -r 5 \
+ > --config experimental.evolution.allowdivergence=yes
3 changesets folded
$ hg log -r tip -T '{desc}'
r4
@@ -381,3 +383,37 @@
o 0: r0
$ cd ..
+
+Fold should respect experimental.evolution.allowdivergence option
+https://bz.mercurial-scm.org/show_bug.cgi?id=5817
+
+ $ hg init issue5817
+ $ cd issue5817
+
+ $ echo A > foo
+ $ hg ci -qAm A
+ $ echo B > foo
+ $ hg ci -m B
+ $ echo C > foo
+ $ hg ci -m C
+
+ $ hg fold --exact -r 'desc("A")::desc("B")' -m 'first fold'
+ 1 new orphan changesets
+ 2 changesets folded
+
+fold aborts here because divergence is not allowed
+
+ $ hg fold --exact -r 'desc("A")::desc("B")' -m 'second fold' \
+ > --config experimental.evolution.allowdivergence=no
+ abort: folding obsolete revisions may cause divergence
+ (set experimental.evolution.allowdivergence=yes to allow folding them)
+ [255]
+
+but if we allow divergence, this should work and should create new content-divergent changesets
+
+ $ hg fold --exact -r 'desc("A")::desc("B")' -m 'second fold' \
+ > --config experimental.evolution.allowdivergence=yes
+ 2 new content-divergent changesets
+ 2 changesets folded
+
+ $ cd ..
--- a/tests/test-topic-stack.t Sun Sep 08 21:24:45 2019 +0200
+++ b/tests/test-topic-stack.t Tue Sep 10 07:38:46 2019 +0200
@@ -794,7 +794,7 @@
$ hg stack red
### topic: red
- ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
+ ### target: default (branch), 7 behind
s5$ c_H (orphan)
^ c_G
^ c_D
@@ -868,7 +868,7 @@
$ hg stack red
### topic: red
- ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
+ ### target: default (branch), 7 behind
s5$ c_H (orphan)
^ c_G
^ c_D