changeset 38508:3beb0ea083df

histedit: use hg.updaterepo() to avoid ui.{push|pop}buffer() hack In some parts of code, we call hg.update() and surround that with ui.pushbuffer() and ui.popbuffer() to suppress the output returned by hg.update(). We have hg.updaterepo() which does not writes to UI and can be used instead. Differential Revision: https://phab.mercurial-scm.org/D3862
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 30 Jun 2018 07:05:36 +0530
parents 077301ac69dc
children c6a2ce82e60b
files hgext/histedit.py
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Jun 29 14:43:41 2018 -0700
+++ b/hgext/histedit.py	Sat Jun 30 07:05:36 2018 +0530
@@ -779,9 +779,7 @@
 
     def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
         parent = ctx.parents()[0].node()
-        repo.ui.pushbuffer()
-        hg.update(repo, parent)
-        repo.ui.popbuffer()
+        hg.updaterepo(repo, parent, False)
         ### prepare new commit data
         commitopts = {}
         commitopts['user'] = ctx.user()
@@ -812,9 +810,7 @@
                          skipprompt=self.skipprompt())
         if n is None:
             return ctx, []
-        repo.ui.pushbuffer()
-        hg.update(repo, n)
-        repo.ui.popbuffer()
+        hg.updaterepo(repo, n, False)
         replacements = [(oldctx.node(), (newnode,)),
                         (ctx.node(), (n,)),
                         (newnode, (n,)),
@@ -1176,9 +1172,7 @@
 
 def _finishhistedit(ui, repo, state, fm):
     """This action runs when histedit is finishing its session"""
-    repo.ui.pushbuffer()
-    hg.update(repo, state.parentctxnode, quietempty=True)
-    repo.ui.popbuffer()
+    hg.updaterepo(repo, state.parentctxnode, False)
 
     mapping, tmpnodes, created, ntm = processreplacement(state)
     if mapping: