[PATCH] dispatch: pass the correct ui to runcommand

Idan Kamara idankk86 at gmail.com
Fri Jun 24 11:36:50 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1308933404 -10800
# Branch stable
# Node ID 4f7274bb9e576b3d9f1d9728c1e9c8928fbad330
# Parent  fd35867ef9ed1bb96ad4f00e801614aaf3496779
dispatch: pass the correct ui to runcommand

For commands that take a repo, repo.ui is passed as the ui to runcommand.
This restores that behaviour when the request has a repo.

diff -r fd35867ef9ed -r 4f7274bb9e57 mercurial/dispatch.py
--- a/mercurial/dispatch.py	Fri Jun 24 17:04:21 2011 +0300
+++ b/mercurial/dispatch.py	Fri Jun 24 19:36:44 2011 +0300
@@ -623,10 +623,9 @@
         if not repo:
             try:
                 repo = hg.repository(ui, path=path)
-                ui = repo.ui
                 if not repo.local():
                     raise util.Abort(_("repository '%s' is not local") % path)
-                ui.setconfig("bundle", "mainreporoot", repo.root)
+                repo.ui.setconfig("bundle", "mainreporoot", repo.root)
             except error.RequirementError:
                 raise
             except error.RepoError:
@@ -641,6 +640,8 @@
                         raise error.RepoError(_("no repository found in %r"
                                                 " (.hg not found)") % os.getcwd())
                     raise
+        if repo:
+            ui = repo.ui
         args.insert(0, repo)
     elif rpath:
         ui.warn(_("warning: --repository ignored\n"))


More information about the Mercurial-devel mailing list