Patchwork D6177: histedit: narrow the scope of discarded ui output

login
register
mail settings
Submitter phabricator
Date April 2, 2019, 10:41 p.m.
Message ID <160bd2fcfa7df16df4cf493dc483212f@localhost.localdomain>
Download mbox | patch
Permalink /patch/39457/
State Not Applicable
Headers show

Comments

phabricator - April 2, 2019, 10:41 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG15d2afa31e57: histedit: narrow the scope of discarded ui output (authored by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6177?vs=14614&id=14636#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6177?vs=14614&id=14636

REVISION DETAIL
  https://phab.mercurial-scm.org/D6177

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-edit.t
  tests/test-histedit-fold-non-commute.t
  tests/test-histedit-fold.t
  tests/test-histedit-merge-tools.t
  tests/test-histedit-non-commute.t
  tests/test-histedit-obsolete.t
  tests/test-qrecord.t

CHANGE DETAILS




To: rdamazio, durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -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]
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -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]
diff --git a/tests/test-histedit-non-commute.t b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -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)
diff --git a/tests/test-histedit-merge-tools.t b/tests/test-histedit-merge-tools.t
new file mode 100644
--- /dev/null
+++ b/tests/test-histedit-merge-tools.t
@@ -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)
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -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
diff --git a/tests/test-histedit-fold-non-commute.t b/tests/test-histedit-fold-non-commute.t
--- a/tests/test-histedit-fold-non-commute.t
+++ b/tests/test-histedit-fold-non-commute.t
@@ -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)
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -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]
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -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)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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