Patchwork D2761: rebase: use configoverride context manager for ui.forcemerge

login
register
mail settings
Submitter phabricator
Date March 13, 2018, 2:55 p.m.
Message ID <45f6b185338a11814c33aef0cb5a48d7@localhost.localdomain>
Download mbox | patch
Permalink /patch/29443/
State Not Applicable
Headers show

Comments

phabricator - March 13, 2018, 2:55 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6b6d7f127ee5: rebase: use configoverride context manager for ui.forcemerge (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2761?vs=6873&id=6987

REVISION DETAIL
  https://phab.mercurial-scm.org/D2761

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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')