# HG changeset patch # User Jun Wu # Date 1489700195 25200 # Node ID f84fbd27b6d38c539f1ae8b7af712ec658210204 # Parent 2017b5a5685b72f21b1a96cf2e562a29c5e794a6 histedit: get rid of ui.backupconfig diff -r 2017b5a5685b -r f84fbd27b6d3 hgext/histedit.py --- a/hgext/histedit.py Thu Mar 16 14:34:35 2017 -0700 +++ b/hgext/histedit.py Thu Mar 16 14:36:35 2017 -0700 @@ -502,16 +502,12 @@ """ phasemin = src.phase() def commitfunc(**kwargs): - phasebackup = repo.ui.backupconfig('phases', 'new-commit') - try: - repo.ui.setconfig('phases', 'new-commit', phasemin, - 'histedit') + overrides = {('phases', 'new-commit'): phasemin} + with repo.ui.configoverride(overrides, 'histedit'): extra = kwargs.get('extra', {}).copy() extra['histedit_source'] = src.hex() kwargs['extra'] = extra return repo.commit(**kwargs) - finally: - repo.ui.restoreconfig(phasebackup) return commitfunc def applychanges(ui, repo, ctx, opts): @@ -762,14 +758,11 @@ # here. This is sufficient to solve issue3681 anyway. extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex()) commitopts['extra'] = extra - phasebackup = repo.ui.backupconfig('phases', 'new-commit') - try: - phasemin = max(ctx.phase(), oldctx.phase()) - repo.ui.setconfig('phases', 'new-commit', phasemin, 'histedit') + phasemin = max(ctx.phase(), oldctx.phase()) + overrides = {('phases', 'new-commit'): phasemin} + with repo.ui.configoverride(overrides, 'histedit'): n = collapse(repo, ctx, repo[newnode], commitopts, skipprompt=self.skipprompt()) - finally: - repo.ui.restoreconfig(phasebackup) if n is None: return ctx, [] repo.ui.pushbuffer()