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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jun 15 08:49:19 EDT 2018


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

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)



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


More information about the Mercurial-devel mailing list