chistedit: use context manager to set verbose ui
I'm still not exactly sure why this is necessary -- perhaps setting it
unconditionally would leak this setting in chg invocations.
Regardless, this would have looked very out of place as compared to
how this setting is done everywhere else, so at least for the sake of
style, let's be consistent with the rest of the codebase.
--- a/hgext/histedit.py Tue Apr 16 17:26:38 2019 +0200
+++ b/hgext/histedit.py Tue Apr 16 13:12:21 2019 -0400
@@ -1230,12 +1230,13 @@
def patchcontents(state):
repo = state['repo']
rule = state['rules'][state['pos']]
- repo.ui.verbose = True
displayer = logcmdutil.changesetdisplayer(repo.ui, repo, {
"patch": True, "template": "status"
}, buffered=True)
- displayer.show(rule.ctx)
- displayer.close()
+ overrides = {('ui', 'verbose'): True}
+ with repo.ui.configoverride(overrides, source='histedit'):
+ displayer.show(rule.ctx)
+ displayer.close()
return displayer.hunk[rule.ctx.rev()].splitlines()
def _chisteditmain(repo, rules, stdscr):