Patchwork dispatch: take --hidden from individual commands into account

login
register
mail settings
Submitter Julien Cristau
Date Jan. 27, 2014, 8:42 a.m.
Message ID <6faa528c91ae251ee99c.1390812156@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/3409/
State Superseded
Commit 69a0d22b96775e44a31d11436d7f93f51cb98031
Headers show

Comments

Julien Cristau - Jan. 27, 2014, 8:42 a.m.
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1390590026 -3600
#      Fri Jan 24 20:00:26 2014 +0100
# Branch stable
# Node ID 6faa528c91ae251ee99c55a01180c57cde764488
# Parent  427d672c0e4e07642d2400a28946cefde11e04ff
dispatch: take --hidden from individual commands into account

The command server would otherwise ignore that option, since the repo
object is only created once.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -772,12 +772,10 @@  def _dispatch(req):
         else:
             try:
                 repo = hg.repository(ui, path=path)
                 if not repo.local():
                     raise util.Abort(_("repository '%s' is not local") % path)
-                if options['hidden']:
-                    repo = repo.unfiltered()
                 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
             except error.RequirementError:
                 raise
             except error.RepoError:
                 if cmd not in commands.optionalrepo.split():
@@ -793,10 +791,12 @@  def _dispatch(req):
                                                 " (.hg not found)")
                                               % os.getcwd())
                     raise
         if repo:
             ui = repo.ui
+            if options['hidden']:
+                repo = repo.unfiltered()
         args.insert(0, repo)
     elif rpath:
         ui.warn(_("warning: --repository ignored\n"))
 
     msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)