histedit: limit updated and merging output to important updates
Output is retained when:
* There's a conflict
* User asked to edit
* User aborts
otherwise, output is suppressed
--- a/hgext/histedit.py Thu Feb 04 23:30:49 2016 +0000
+++ b/hgext/histedit.py Wed Feb 03 13:52:04 2016 +0000
@@ -447,13 +447,18 @@
parentctx, but does not commit them."""
repo = self.repo
rulectx = repo[self.node]
+ repo.ui.pushbuffer(error=True, labeled=True)
hg.update(repo, self.state.parentctxnode, quietempty=True)
stats = applychanges(repo.ui, repo, rulectx, {})
if stats and stats[3] > 0:
+ 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
@@ -733,7 +738,9 @@
def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
parent = ctx.parents()[0].node()
+ repo.ui.pushbuffer()
hg.update(repo, parent)
+ repo.ui.popbuffer()
### prepare new commit data
commitopts = {}
commitopts['user'] = ctx.user()
@@ -764,7 +771,9 @@
repo.ui.restoreconfig(phasebackup)
if n is None:
return ctx, []
+ repo.ui.pushbuffer()
hg.update(repo, n)
+ repo.ui.popbuffer()
replacements = [(oldctx.node(), (newnode,)),
(ctx.node(), (n,)),
(newnode, (n,)),
@@ -1167,7 +1176,9 @@
state.write()
ui.progress(_("editing"), None)
+ repo.ui.pushbuffer()
hg.update(repo, state.parentctxnode, quietempty=True)
+ repo.ui.popbuffer()
mapping, tmpnodes, created, ntm = processreplacement(state)
if mapping:
--- a/tests/test-histedit-arguments.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-arguments.t Wed Feb 03 13:52:04 2016 +0000
@@ -243,9 +243,6 @@
> p c8e68270e35a 3 four
> f 08d98a8350f3 4 five
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- reverting alpha
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
four
***
five
@@ -258,7 +255,6 @@
HG: user: test
HG: branch 'default'
HG: changed alpha
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
--- a/tests/test-histedit-commute.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-commute.t Wed Feb 03 13:52:04 2016 +0000
@@ -104,7 +104,6 @@
> pick 055a42cdd887 d
> EOF
$ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
log after edit
$ hg log --graph
@@ -148,7 +147,6 @@
> pick d8249471110a e
> pick 8ade9693061e f
> EOF
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg log --graph
@ changeset: 5:7eca9b5b1148
@@ -191,7 +189,6 @@
> pick 915da888f2de e
> pick 177f92b77385 c
> EOF
- 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
$ hg log --graph
@ changeset: 5:38b92f448761
| tag: tip
@@ -232,7 +229,6 @@
> pick 38b92f448761 c
> pick de71b079d9ce e
> EOF
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ hg log --graph
@ changeset: 7:803ef1c6fcfd
| tag: tip
@@ -417,11 +413,6 @@
> EOF
$ HGEDITOR="sh ./editor.sh" hg histedit 0
- 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding another-dir/initial-file (glob)
- removing initial-dir/initial-file (glob)
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
--- a/tests/test-histedit-drop.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-drop.t Wed Feb 03 13:52:04 2016 +0000
@@ -59,7 +59,6 @@
> pick 652413bf663e f
> pick 055a42cdd887 d
> EOF
- 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
log after edit
$ hg log --graph
@@ -124,7 +123,6 @@
> pick a4f7421b80f7 f
> drop f518305ce889 d
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg log --graph
@ changeset: 3:a4f7421b80f7
| tag: tip
@@ -158,7 +156,6 @@
> pick cb9a9f314b8b a
> pick ee283cb5f2d5 e
> EOF
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg log --graph
@ changeset: 1:e99c679bf03e
| tag: tip
--- a/tests/test-histedit-edit.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-edit.t Wed Feb 03 13:52:04 2016 +0000
@@ -286,7 +286,6 @@
> mv tmp "\$1"
> EOF
$ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg status
$ hg log --limit 1
changeset: 6:1fd3b2fe7754
@@ -327,7 +326,6 @@
$ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
> mess 1fd3b2fe7754 f
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
abort: emulating unexpected abort
$ test -f .hg/last-message.txt
[1]
@@ -354,8 +352,6 @@
$ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
> mess 1fd3b2fe7754 f
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding f
==== before editing
f
@@ -408,7 +404,6 @@
$ hg histedit tip --commands - 2>&1 << EOF | fixbundle
> mess 1fd3b2fe7754 f
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg status
$ hg log --limit 1
changeset: 6:62feedb1200e
--- a/tests/test-histedit-fold-non-commute.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-fold-non-commute.t Wed Feb 03 13:52:04 2016 +0000
@@ -104,7 +104,6 @@
> print
> EOF
$ HGEDITOR="python cat.py" hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
d
***
does not commute with e
@@ -121,7 +120,6 @@
- 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 7b4e2f4b7bcd)
@@ -262,8 +260,6 @@
(no more unresolved files)
continue: hg histedit --continue
$ hg histedit --continue 2>&1 | fixbundle | grep -v '2 files removed'
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- 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 7b4e2f4b7bcd)
--- a/tests/test-histedit-fold.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-fold.t Wed Feb 03 13:52:04 2016 +0000
@@ -54,9 +54,6 @@
> fold 177f92b77385 c
> pick 055a42cdd887 d
> EOF
- 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
log after edit
$ hg logt --graph
@@ -111,9 +108,6 @@
> pick 6de59d13424a f
> pick 9c277da72c9b d
> EOF
- 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ HGEDITOR=$OLDHGEDITOR
@@ -177,10 +171,7 @@
> pick 8e03a72b6f83 f
> fold c4a9eb7989fc d
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- adding d
allow non-folding commit
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
==== before editing
f
***
@@ -242,9 +233,6 @@
> EOF
editing: pick e860deea161a 4 e 1/2 changes (50.00%)
editing: fold a00ad806cb55 5 f 2/2 changes (100.00%)
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
tip after edit
$ hg log --rev .
@@ -372,7 +360,6 @@
created new head
$ echo 6 >> file
$ HGEDITOR=cat hg histedit --continue
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+4
***
+5.2
@@ -387,7 +374,6 @@
HG: user: test
HG: branch 'default'
HG: changed file
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/55c8d8dc79ce-4066cd98-backup.hg (glob)
saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-a35700fc-backup.hg (glob)
$ hg logt -G
@@ -443,10 +429,6 @@
> pick 1c4f440a8085 rename
> fold e0371e0426bc b
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- reverting b.txt
- 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
- 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg logt --follow b.txt
1:cf858d235c76 rename
@@ -489,9 +471,6 @@
> fold a1a953ffb4b0 c
> pick 6c795aa153cb a
> EOF
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
commit 9599899f62c05f4377548c32bf1c9f1a39634b0c
$ hg logt
@@ -530,13 +509,6 @@
> fold b7389cc4d66e 3 foo2
> fold 21679ff7675c 4 foo3
> EOF
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- reverting foo
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- merging foo
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg logt
2:e8bedbda72c1 merged foos
1:578c7455730c a
--- a/tests/test-histedit-non-commute-abort.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-non-commute-abort.t Wed Feb 03 13:52:04 2016 +0000
@@ -69,7 +69,6 @@
> pick e860deea161a e
> pick 652413bf663e f
> EOF
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
merging e
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
Fix up the change (pick e860deea161a)
--- a/tests/test-histedit-obsolete.t Thu Feb 04 23:30:49 2016 +0000
+++ b/tests/test-histedit-obsolete.t Wed Feb 03 13:52:04 2016 +0000
@@ -108,7 +108,6 @@
> drop 59d9f330561f 7 d
> pick cacdfd884a93 8 f
> EOF
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg log --graph
@ 11:c13eb81022ca f
|
@@ -167,7 +166,6 @@
> pick 40db8afa467b 10 c
> drop b449568bf7fc 11 f
> EOF
- 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg log -G
@ 12:40db8afa467b c
|
@@ -187,7 +185,6 @@
> pick 40db8afa467b 10 c
> drop 1b3b05f35ff0 13 h
> EOF
- 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg log -G
@ 17:ee6544123ab8 c
|
@@ -357,7 +354,6 @@
> pick 7395e1ff83bd 13 h
> pick ee118ab9fa44 16 k
> EOF
- 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
$ hg log -G
@ 23:558246857888 (secret) k
|
@@ -399,13 +395,6 @@
> pick b605fb7503f2 14 i
> fold ee118ab9fa44 16 k
> EOF
- 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -G
@ 27:f9daec13fb98 (secret) i
|