[PATCH v2] dispatch: take --hidden from individual commands into account
Julien Cristau
julien.cristau at logilab.fr
Mon Jan 27 04:11:27 CST 2014
# HG changeset patch
# User Julien Cristau <julien.cristau at logilab.fr>
# Date 1390816640 -3600
# Mon Jan 27 10:57:20 2014 +0100
# Branch stable
# Node ID 52fd2aac6f7e2af595033c069df22f665352f360
# 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.
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)
diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -260,10 +260,19 @@ def phasecacheafterstrip(server):
os.system('hg -q --config extensions.mq= strip 1')
# shouldn't raise "7966c8e3734d: no node!"
runcommand(server, ['branches'])
+def obsolete(server):
+ readchannel(server)
+
+ runcommand(server, ['up', 'null'])
+ runcommand(server, ['phase', '-df', 'tip'])
+ os.system('hg debugobsolete `hg log -r tip --template {node}`')
+ runcommand(server, ['log', '--hidden'])
+ runcommand(server, ['log'])
+
if __name__ == '__main__':
os.system('hg init')
check(hellomessage)
check(unknowncommand)
@@ -283,5 +292,12 @@ if __name__ == '__main__':
check(setphase)
check(rollback)
check(branch)
check(hgignore)
check(phasecacheafterstrip)
+ obs = open('obs.py', 'w')
+ obs.write('import mercurial.obsolete\nmercurial.obsolete._enabled = True\n')
+ obs.close()
+ hgrc = open('.hg/hgrc', 'a')
+ hgrc.write('[extensions]\nobs=obs.py\n')
+ hgrc.close()
+ check(obsolete)
diff --git a/tests/test-commandserver.py.out b/tests/test-commandserver.py.out
--- a/tests/test-commandserver.py.out
+++ b/tests/test-commandserver.py.out
@@ -189,5 +189,36 @@ o 0:eff892de26ec
runcommand phase -p .
runcommand phase .
5: public
runcommand branches
default 1:731265503d86
+
+testing obsolete:
+
+ runcommand up null
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ runcommand phase -df tip
+ runcommand log --hidden
+changeset: 1:731265503d86
+tag: tip
+user: test
+date: Thu Jan 01 00:00:00 1970 +0000
+summary: .
+
+changeset: 0:eff892de26ec
+bookmark: bm1
+bookmark: bm2
+bookmark: bm3
+user: test
+date: Thu Jan 01 00:00:00 1970 +0000
+summary: 1
+
+ runcommand log
+changeset: 0:eff892de26ec
+bookmark: bm1
+bookmark: bm2
+bookmark: bm3
+tag: tip
+user: test
+date: Thu Jan 01 00:00:00 1970 +0000
+summary: 1
+
More information about the Mercurial-devel
mailing list