Patchwork D3741: update: use context manager for config override (API)

login
register
mail settings
Submitter phabricator
Date June 15, 2018, 12:49 p.m.
Message ID <821ef4fe74dca1469145ae4623b29ea8@localhost.localdomain>
Download mbox | patch
Permalink /patch/32169/
State Not Applicable
Headers show

Comments

phabricator - June 15, 2018, 12:49 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG929405af558a: update: use context manager for config override (API) (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3741?vs=9070&id=9085#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3741?vs=9070&id=9085

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5657,10 +5657,10 @@ 
         ctx = scmutil.revsingle(repo, rev, rev)
         rev = ctx.rev()
         hidden = ctx.hidden()
-        repo.ui.setconfig('ui', 'forcemerge', opts.get(r'tool'), 'update')
-
-        ret = hg.updatetotally(ui, repo, rev, brev, clean=clean,
-                               updatecheck=updatecheck)
+        overrides = {('ui', 'forcemerge'): opts.get(r'tool', '')}
+        with ui.configoverride(overrides, 'update'):
+            ret = hg.updatetotally(ui, repo, rev, brev, clean=clean,
+                                   updatecheck=updatecheck)
         if hidden:
             ctxstr = ctx.hex()[:12]
             ui.warn(_("updated to hidden changeset %s\n") % ctxstr)