histedit: narrow the scope of discarded ui output
In
34165875fa5df813bec3a0cd348932b304d44efb, a lot of the output from
histedit was excluded. This slightly adjusts the scope of that exclusion,
to both discard more uninsteresting messages, and ensure that pre-merge-tool
output gets shown before the external merge tool is executed.
Differential Revision: https://phab.mercurial-scm.org/D6177
--- a/hgext/histedit.py Fri Mar 29 21:53:15 2019 -0400
+++ b/hgext/histedit.py Mon Apr 01 19:02:24 2019 -0700
@@ -522,17 +522,14 @@
rulectx = repo[self.node]
repo.ui.pushbuffer(error=True, labeled=True)
hg.update(repo, self.state.parentctxnode, quietempty=True)
+ repo.ui.popbuffer()
stats = applychanges(repo.ui, repo, rulectx, {})
repo.dirstate.setbranch(rulectx.branch())
if stats.unresolvedcount:
- buf = repo.ui.popbuffer()
- repo.ui.write(buf)
raise error.InterventionRequired(
_('Fix up the change (%s %s)') %
(self.verb, node.short(self.node)),
hint=_('hg histedit --continue to resume'))
- else:
- repo.ui.popbuffer()
def continuedirty(self):
"""Continues the action when changes have been applied to the working
@@ -593,8 +590,10 @@
if ctx.p1().node() == wcpar:
# edits are "in place" we do not need to make any merge,
# just applies changes on parent for editing
+ ui.pushbuffer()
cmdutil.revert(ui, repo, ctx, (wcpar, node.nullid), all=True)
stats = mergemod.updateresult(0, 0, 0, 0)
+ ui.popbuffer()
else:
try:
# ui.forcemerge is an internal variable, do not document
--- a/tests/test-histedit-arguments.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-arguments.t Mon Apr 01 19:02:24 2019 -0700
@@ -139,7 +139,6 @@
> edit 08d98a8350f3 4 five
> EOF
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- reverting alpha
Editing (08d98a8350f3), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]
@@ -476,7 +475,6 @@
> pick 8cde254db839
> edit 6f2f0241f119
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging foo
warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
Fix up the change (pick 8cde254db839)
--- a/tests/test-histedit-edit.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-edit.t Mon Apr 01 19:02:24 2019 -0700
@@ -433,7 +433,6 @@
> edit cb9a9f314b8b a > $EDITED
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding a
Editing (cb9a9f314b8b), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]
--- a/tests/test-histedit-fold-non-commute.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-fold-non-commute.t Mon Apr 01 19:02:24 2019 -0700
@@ -94,7 +94,6 @@
edit the history
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (fold 42abbb61bede)
@@ -249,7 +248,6 @@
edit the history
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (roll 42abbb61bede)
--- a/tests/test-histedit-fold.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-fold.t Mon Apr 01 19:02:24 2019 -0700
@@ -287,7 +287,6 @@
> drop 888f9082bf99 2 +5
> fold 251d831eeec5 3 +6
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging file
warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
Fix up the change (fold 251d831eeec5)
@@ -361,7 +360,6 @@
> drop 888f9082bf99 2 +5
> fold 251d831eeec5 3 +6
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging file
warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
Fix up the change (fold 251d831eeec5)
@@ -541,6 +539,7 @@
> fold b7389cc4d66e 3 foo2
> fold 21679ff7675c 4 foo3
> EOF
+ merging foo
$ hg logt
2:e8bedbda72c1 merged foos
1:578c7455730c a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-histedit-merge-tools.t Mon Apr 01 19:02:24 2019 -0700
@@ -0,0 +1,57 @@
+Test histedit extension: Merge tools
+====================================
+
+Initialization
+---------------
+
+ $ . "$TESTDIR/histedit-helpers.sh"
+
+ $ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > logt = log --template '{rev}:{node|short} {desc|firstline}\n'
+ > [extensions]
+ > histedit=
+ > mockmakedate = $TESTDIR/mockmakedate.py
+ > [ui]
+ > pre-merge-tool-output-template='pre-merge message for {node}\n'
+ > EOF
+
+Merge conflict
+--------------
+
+ $ hg init r
+ $ cd r
+ $ echo foo > file
+ $ hg add file
+ $ hg ci -m "First" -d "1 0"
+ $ echo bar > file
+ $ hg ci -m "Second" -d "2 0"
+
+ $ hg logt --graph
+ @ 1:2aa920f62fb9 Second
+ |
+ o 0:7181f42b8fca First
+
+
+Invert the order of the commits, but fail the merge.
+ $ hg histedit --config ui.merge=false --commands - 2>&1 <<EOF | fixbundle
+ > pick 2aa920f62fb9 Second
+ > pick 7181f42b8fca First
+ > EOF
+ merging file
+ pre-merge message for b90fa2e91a6d11013945a5f684be45b84a8ca6ec
+ merging file failed!
+ Fix up the change (pick 7181f42b8fca)
+ (hg histedit --continue to resume)
+
+ $ hg histedit --abort | fixbundle
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Invert the order of the commits, and pretend the merge succeeded.
+ $ hg histedit --config ui.merge=true --commands - 2>&1 <<EOF | fixbundle
+ > pick 2aa920f62fb9 Second
+ > pick 7181f42b8fca First
+ > EOF
+ merging file
+ pre-merge message for b90fa2e91a6d11013945a5f684be45b84a8ca6ec
+ 7181f42b8fca: skipping changeset (no changes)
--- a/tests/test-histedit-non-commute.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-non-commute.t Mon Apr 01 19:02:24 2019 -0700
@@ -87,7 +87,6 @@
edit the history
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (pick 39522b764e3d)
@@ -145,7 +144,6 @@
edit the history
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (pick 39522b764e3d)
@@ -241,7 +239,6 @@
edit the history, this time with a fold action
$ hg histedit 3 --commands $EDITED 2>&1 | fixbundle
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (mess 39522b764e3d)
--- a/tests/test-histedit-obsolete.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-histedit-obsolete.t Mon Apr 01 19:02:24 2019 -0700
@@ -216,7 +216,6 @@
> edit b346ab9a313d 6 c
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding c
Editing (b346ab9a313d), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]
@@ -351,7 +350,6 @@
> pick ee118ab9fa44 16 k
> EOF
0 files updated, 0 files merged, 6 files removed, 0 files unresolved
- adding f
Editing (b449568bf7fc), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]
@@ -394,7 +392,6 @@
> pick ee118ab9fa44 16 k
> EOF
0 files updated, 0 files merged, 6 files removed, 0 files unresolved
- adding f
Editing (b449568bf7fc), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]
--- a/tests/test-qrecord.t Fri Mar 29 21:53:15 2019 -0400
+++ b/tests/test-qrecord.t Mon Apr 01 19:02:24 2019 -0700
@@ -446,7 +446,6 @@
> edit ea55e2ae468f foo bar
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding a
Editing (ea55e2ae468f), you may commit or record as needed now.
(hg histedit --continue to resume)
[1]