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.
durin42 |
hg-reviewers |
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.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
This exists mainly so that 'rollup' rules can be a subclass of | This exists mainly so that 'rollup' rules can be a subclass of | ||||
'fold'. | 'fold'. | ||||
""" | """ | ||||
return False | return False | ||||
def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): | def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): | ||||
parent = ctx.parents()[0].node() | parent = ctx.parents()[0].node() | ||||
repo.ui.pushbuffer() | hg.updaterepo(repo, parent, False) | ||||
hg.update(repo, parent) | |||||
repo.ui.popbuffer() | |||||
### prepare new commit data | ### prepare new commit data | ||||
commitopts = {} | commitopts = {} | ||||
commitopts['user'] = ctx.user() | commitopts['user'] = ctx.user() | ||||
# commit message | # commit message | ||||
if not self.mergedescs(): | if not self.mergedescs(): | ||||
newmessage = ctx.description() | newmessage = ctx.description() | ||||
else: | else: | ||||
newmessage = '\n***\n'.join( | newmessage = '\n***\n'.join( | ||||
commitopts['extra'] = extra | commitopts['extra'] = extra | ||||
phasemin = max(ctx.phase(), oldctx.phase()) | phasemin = max(ctx.phase(), oldctx.phase()) | ||||
overrides = {('phases', 'new-commit'): phasemin} | overrides = {('phases', 'new-commit'): phasemin} | ||||
with repo.ui.configoverride(overrides, 'histedit'): | with repo.ui.configoverride(overrides, 'histedit'): | ||||
n = collapse(repo, ctx, repo[newnode], commitopts, | n = collapse(repo, ctx, repo[newnode], commitopts, | ||||
skipprompt=self.skipprompt()) | skipprompt=self.skipprompt()) | ||||
if n is None: | if n is None: | ||||
return ctx, [] | return ctx, [] | ||||
repo.ui.pushbuffer() | hg.updaterepo(repo, n, False) | ||||
hg.update(repo, n) | |||||
repo.ui.popbuffer() | |||||
replacements = [(oldctx.node(), (newnode,)), | replacements = [(oldctx.node(), (newnode,)), | ||||
(ctx.node(), (n,)), | (ctx.node(), (n,)), | ||||
(newnode, (n,)), | (newnode, (n,)), | ||||
] | ] | ||||
for ich in internalchanges: | for ich in internalchanges: | ||||
replacements.append((ich, (n,))) | replacements.append((ich, (n,))) | ||||
return repo[n], replacements | return repo[n], replacements | ||||
state.parentctxnode = parentctx.node() | state.parentctxnode = parentctx.node() | ||||
state.replacements.extend(replacement_) | state.replacements.extend(replacement_) | ||||
state.actions.pop(0) | state.actions.pop(0) | ||||
state.write() | state.write() | ||||
def _finishhistedit(ui, repo, state, fm): | def _finishhistedit(ui, repo, state, fm): | ||||
"""This action runs when histedit is finishing its session""" | """This action runs when histedit is finishing its session""" | ||||
repo.ui.pushbuffer() | hg.updaterepo(repo, state.parentctxnode, False) | ||||
hg.update(repo, state.parentctxnode, quietempty=True) | |||||
repo.ui.popbuffer() | |||||
mapping, tmpnodes, created, ntm = processreplacement(state) | mapping, tmpnodes, created, ntm = processreplacement(state) | ||||
if mapping: | if mapping: | ||||
for prec, succs in mapping.iteritems(): | for prec, succs in mapping.iteritems(): | ||||
if not succs: | if not succs: | ||||
ui.debug('histedit: %s is dropped\n' % node.short(prec)) | ui.debug('histedit: %s is dropped\n' % node.short(prec)) | ||||
else: | else: | ||||
ui.debug('histedit: %s is replaced by %s\n' % ( | ui.debug('histedit: %s is replaced by %s\n' % ( |