D3862: histedit: use hg.updaterepo() to avoid ui.{push|pop}buffer() hack

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Jun 30 15:09:27 UTC 2018


pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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:



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


More information about the Mercurial-devel mailing list