dispatch: take --hidden from individual commands into account stable
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 27 Jan 2014 10:57:20 +0100
branchstable
changeset 20330 69a0d22b9677
parent 20329 45f23b1ff345
child 20331 1d155582a8ea
dispatch: take --hidden from individual commands into account The command server would otherwise ignore that option, since the repo object is only created once.
mercurial/dispatch.py
tests/test-commandserver.py
tests/test-commandserver.py.out
--- a/mercurial/dispatch.py	Thu Jan 30 15:03:36 2014 +0900
+++ b/mercurial/dispatch.py	Mon Jan 27 10:57:20 2014 +0100
@@ -773,8 +773,6 @@
                 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
@@ -794,6 +792,8 @@
                     raise
         if repo:
             ui = repo.ui
+            if options['hidden']:
+                repo = repo.unfiltered()
         args.insert(0, repo)
     elif rpath:
         ui.warn(_("warning: --repository ignored\n"))
--- a/tests/test-commandserver.py	Thu Jan 30 15:03:36 2014 +0900
+++ b/tests/test-commandserver.py	Mon Jan 27 10:57:20 2014 +0100
@@ -262,6 +262,15 @@
     # 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')
 
@@ -285,3 +294,10 @@
     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)
--- a/tests/test-commandserver.py.out	Thu Jan 30 15:03:36 2014 +0900
+++ b/tests/test-commandserver.py.out	Mon Jan 27 10:57:20 2014 +0100
@@ -191,3 +191,34 @@
 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
+