changeset 36930:36de8a3c429c

rebase: use configoverride context manager for ui.forcemerge Differential Revision: https://phab.mercurial-scm.org/D2761
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 09 Mar 2018 12:48:00 -0800
parents cc2bfc7d5362
children 28f988093911
files hgext/rebase.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Mar 09 12:45:50 2018 -0800
+++ b/hgext/rebase.py	Fri Mar 09 12:48:00 2018 -0800
@@ -481,9 +481,8 @@
                 if len(repo[None].parents()) == 2:
                     repo.ui.debug('resuming interrupted rebase\n')
                 else:
-                    try:
-                        ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
-                                     'rebase')
+                    overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
+                    with ui.configoverride(overrides, 'rebase'):
                         stats = rebasenode(repo, rev, p1, base, self.collapsef,
                                            dest, wctx=self.wctx)
                         if stats and stats[3] > 0:
@@ -493,8 +492,6 @@
                                 raise error.InterventionRequired(
                                     _('unresolved conflicts (see hg '
                                       'resolve, then hg rebase --continue)'))
-                    finally:
-                        ui.setconfig('ui', 'forcemerge', '', 'rebase')
                 if not self.collapsef:
                     merging = p2 != nullrev
                     editform = cmdutil.mergeeditform(merging, 'rebase')