fold: sort concatenated commit messages in topological order
It seems better to have the proposed commit message look the same
whether the user ran `hg fold --exact -r . -r .^` or `hg fold --exact
-r .^ -r .`.
--- a/CHANGELOG Wed Dec 26 14:52:07 2018 +0800
+++ b/CHANGELOG Fri Jan 11 09:26:41 2019 -0800
@@ -9,6 +9,7 @@
* split: no longer accept revision with --rev (BC)
* split: accept file patterns
* split: support for non interactive splits
+ * fold: concatenate commit message in revision order
* push: have `--publish` overrule the `auto-publish` config
* next: evolve aspiring children by default (use --no-evolve to skip)
* next: pick lower part of a split as destination
--- a/hgext3rd/evolve/cmdrewrite.py Wed Dec 26 14:52:07 2018 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py Fri Jan 11 09:26:41 2019 -0800
@@ -740,6 +740,10 @@
ui.write_err(_('single revision specified, nothing to fold\n'))
return 1
+ # Sort so combined commit message of `hg fold --exact -r . -r .^` is
+ # in topological order.
+ revs.sort()
+
wlock = lock = None
try:
wlock = repo.wlock()
--- a/tests/test-evolve-phase-divergence.t Wed Dec 26 14:52:07 2018 +0800
+++ b/tests/test-evolve-phase-divergence.t Fri Jan 11 09:26:41 2019 -0800
@@ -893,7 +893,7 @@
1 new phase-divergent changesets
$ hg glog -r f3794e5a91dc::
- @ 24:e450d05b7d27 added g
+ @ 24:390acb97e50a added f
| () draft
| o 23:428f7900a969 added g
| | () public
@@ -906,14 +906,14 @@
~
$ hg evolve --list
- e450d05b7d27: added g
+ 390acb97e50a: added f
phase-divergent: 21ae52e414e6 (immutable precursor)
phase-divergent: 428f7900a969 (immutable precursor)
Resolving phase divergence using `hg evolve`
$ hg evolve --phase-divergent --all
- recreate:[24] added g
+ recreate:[24] added f
atop:[23] added g
rebasing to destination parent: 21ae52e414e6
computing new diff
--- a/tests/test-fold.t Wed Dec 26 14:52:07 2018 +0800
+++ b/tests/test-fold.t Fri Jan 11 09:26:41 2019 -0800
@@ -244,5 +244,29 @@
|
o 0 - 1ea73414a91b r0 [debugbuilddag] (public)
+Test order of proposed commit message
+
+ $ hg fold --exact --hidden -r 4 -r 5 -r 6
+ 2 new content-divergent changesets
+ 3 changesets folded
+ $ hg log -r tip -T '{desc}'
+ r4
+
+
+ r5
+
+
+ r6 (no-eol)
+ $ hg fold --exact --hidden -r 6 -r 4 -r 5
+ 3 changesets folded
+ $ hg log -r tip -T '{desc}'
+ r4
+
+
+ r5
+
+
+ r6 (no-eol)
+
$ cd ..