Mercurial > hg
comparison hgext/histedit.py @ 38504: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 | e5d87c69bbcb |
children | c6a2ce82e60b |
comparison
equal
deleted
inserted
replaced
38503:077301ac69dc | 38504:3beb0ea083df |
---|---|
777 """ | 777 """ |
778 return False | 778 return False |
779 | 779 |
780 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): | 780 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): |
781 parent = ctx.parents()[0].node() | 781 parent = ctx.parents()[0].node() |
782 repo.ui.pushbuffer() | 782 hg.updaterepo(repo, parent, False) |
783 hg.update(repo, parent) | |
784 repo.ui.popbuffer() | |
785 ### prepare new commit data | 783 ### prepare new commit data |
786 commitopts = {} | 784 commitopts = {} |
787 commitopts['user'] = ctx.user() | 785 commitopts['user'] = ctx.user() |
788 # commit message | 786 # commit message |
789 if not self.mergedescs(): | 787 if not self.mergedescs(): |
810 with repo.ui.configoverride(overrides, 'histedit'): | 808 with repo.ui.configoverride(overrides, 'histedit'): |
811 n = collapse(repo, ctx, repo[newnode], commitopts, | 809 n = collapse(repo, ctx, repo[newnode], commitopts, |
812 skipprompt=self.skipprompt()) | 810 skipprompt=self.skipprompt()) |
813 if n is None: | 811 if n is None: |
814 return ctx, [] | 812 return ctx, [] |
815 repo.ui.pushbuffer() | 813 hg.updaterepo(repo, n, False) |
816 hg.update(repo, n) | |
817 repo.ui.popbuffer() | |
818 replacements = [(oldctx.node(), (newnode,)), | 814 replacements = [(oldctx.node(), (newnode,)), |
819 (ctx.node(), (n,)), | 815 (ctx.node(), (n,)), |
820 (newnode, (n,)), | 816 (newnode, (n,)), |
821 ] | 817 ] |
822 for ich in internalchanges: | 818 for ich in internalchanges: |
1174 | 1170 |
1175 state.write() | 1171 state.write() |
1176 | 1172 |
1177 def _finishhistedit(ui, repo, state, fm): | 1173 def _finishhistedit(ui, repo, state, fm): |
1178 """This action runs when histedit is finishing its session""" | 1174 """This action runs when histedit is finishing its session""" |
1179 repo.ui.pushbuffer() | 1175 hg.updaterepo(repo, state.parentctxnode, False) |
1180 hg.update(repo, state.parentctxnode, quietempty=True) | |
1181 repo.ui.popbuffer() | |
1182 | 1176 |
1183 mapping, tmpnodes, created, ntm = processreplacement(state) | 1177 mapping, tmpnodes, created, ntm = processreplacement(state) |
1184 if mapping: | 1178 if mapping: |
1185 for prec, succs in mapping.iteritems(): | 1179 for prec, succs in mapping.iteritems(): |
1186 if not succs: | 1180 if not succs: |