--- a/CHANGELOG Thu Sep 12 12:35:42 2019 +0200
+++ b/CHANGELOG Tue Sep 24 12:42:27 2019 +0200
@@ -18,6 +18,7 @@
* 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
+ * prune: improve documentation for `--pair`
9.1.0 -- 2019-07-29
-------------------
--- a/hgext3rd/evolve/cmdrewrite.py Thu Sep 12 12:35:42 2019 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py Tue Sep 24 12:42:27 2019 +0200
@@ -762,14 +762,6 @@
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()
@@ -1013,6 +1005,12 @@
``--pair`` option to pair the pruned precursor and successor changesets.
This is commonly useful for resolving history divergence, or when someone
else edits history without obsolescence enabled.
+
+ .. container:: verbose
+
+ ``hg prune A::B -s C::D --pair`` will mark all revisions in the A::B
+ range as superseded by the revisions in C::D. Both revsets need to have
+ the same number of changesets.
"""
_checknotesize(ui, opts)
revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
--- a/hgext3rd/evolve/rewriteutil.py Thu Sep 12 12:35:42 2019 +0200
+++ b/hgext3rd/evolve/rewriteutil.py Tue Sep 24 12:42:27 2019 +0200
@@ -117,6 +117,13 @@
if len(baseparents) > 2:
raise error.Abort(_(b"cannot fold revisions that merge with more than "
b"one external changeset (not in revisions)"))
+ if not repo.ui.configbool(b'experimental', b'evolution.allowdivergence'):
+ obsolete = repo.revs(b'%ld and obsolete()', revs)
+ if 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)
# root's p1 is already used as the target ctx p1
baseparents -= {root.p1().rev()}
p2 = repo[baseparents.first()]
--- a/hgext3rd/topic/__init__.py Thu Sep 12 12:35:42 2019 +0200
+++ b/hgext3rd/topic/__init__.py Tue Sep 24 12:42:27 2019 +0200
@@ -393,11 +393,11 @@
finally:
self.ui.restoreconfig(backup)
- def commitctx(self, ctx, error=None):
+ def commitctx(self, ctx, *args, **kwargs):
topicfilter = topicmap.topicfilter(self.filtername)
if topicfilter != self.filtername:
other = self.filtered(topicmap.topicfilter(self.filtername))
- other.commitctx(ctx, error=error)
+ other.commitctx(ctx, *args, **kwargs)
if isinstance(ctx, context.workingcommitctx):
current = self.currenttopic
@@ -409,7 +409,7 @@
and not self.currenttopic):
# we are amending and need to remove a topic
del ctx.extra()[constants.extrakey]
- return super(topicrepo, self).commitctx(ctx, error=error)
+ return super(topicrepo, self).commitctx(ctx, *args, **kwargs)
@property
def topics(self):
--- a/tests/test-issue-6028.t Thu Sep 12 12:35:42 2019 +0200
+++ b/tests/test-issue-6028.t Tue Sep 24 12:42:27 2019 +0200
@@ -25,10 +25,12 @@
$ cd $TESTTMP/issue-6028
create initial commit
+
$ echo "0" > 0
$ hg ci -Am 0
adding 0
+start new topics "a" and "b" both from 0
$ hg up default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -40,7 +42,6 @@
active topic 'a' grew its first changeset
(see 'hg help topics' for more information)
-
$ hg up default
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg topics b
@@ -51,6 +52,8 @@
active topic 'b' grew its first changeset
(see 'hg help topics' for more information)
+create branch "integration" from 0, merge topics "a" and "b" into it
+
$ hg up default
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg branch integration
@@ -66,6 +69,8 @@
(branch merge, don't forget to commit)
$ hg ci -m "merged b"
+commit a bad file on topic "a", merge it into "integration"
+
$ hg up a
switching to topic a
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -79,6 +84,8 @@
(branch merge, don't forget to commit)
$ hg ci -m "merged a bad commit"
+add more commits on both topics and merge them into "integration"
+
$ hg up a
switching to topic a
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -103,7 +110,12 @@
(branch merge, don't forget to commit)
$ hg ci -m "merged bb"
-create instability by pruning two changesets, one in a topic, one in a merge
+create instability by pruning two changesets, one in a topic, one a merge
+
+ $ hg log -r 5:6 -T '{rev}: {desc}\n'
+ 5: a bad commit
+ 6: merged a bad commit
+
$ hg prune -r 5:6
2 changesets pruned
3 new orphan changesets
@@ -112,12 +124,47 @@
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
start the evolve
+
$ hg evolve --update --no-all
move:[8] merged aa
atop:[4] merged b
working directory is now at c920dd828523
+casually checking issue6141: position of p2 is not changed
+
+ $ hg log -r 'predecessors(.) + .'
+ changeset: 8:3f6f25057afb
+ branch: integration
+ parent: 6:cfc4c333724f
+ parent: 7:61eff7f7bb6c
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ obsolete: rebased using evolve as 11:c920dd828523
+ summary: merged aa
+
+ changeset: 11:c920dd828523
+ branch: integration
+ tag: tip
+ parent: 4:e33aee2c715e
+ parent: 7:61eff7f7bb6c
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ instability: orphan
+ summary: merged aa
+
+
+test that we successfully got rid of the bad file
+
+ $ hg d --git -r 'predecessors(.)' -r '.'
+ diff --git a/a_bad_commit b/a_bad_commit
+ deleted file mode 100644
+ --- a/a_bad_commit
+ +++ /dev/null
+ @@ -1,1 +0,0 @@
+ -a bad commit
+
evolve creates an obsolete changeset above as 11
+
$ hg evolve -r .
cannot solve instability of c920dd828523, skipping
cannot solve instability of c920dd828523, skipping