changeset 18267:5bb610f87d1d

clfilter: enforce hidden changeset globally The dispatch code now enables filtering of "hidden" changesets globally. The filter is installed before command and extension invocation. The `--hidden` switch is now global and disables this filtering for any command. Code in log dedicated to changeset exclusion is removed as this global filtering has the same effect.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 08 Jan 2013 20:37:37 +0100
parents 09a2b6741695
children ed25fe3a7e2f
files hgext/graphlog.py mercurial/cmdutil.py mercurial/commands.py mercurial/dispatch.py tests/test-commit-amend.t tests/test-debugcomplete.t tests/test-extension.t tests/test-help.t tests/test-keyword.t tests/test-log.t tests/test-newbranch.t tests/test-obsolete-divergent.t tests/test-obsolete.t
diffstat 13 files changed, 29 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Tue Jan 08 21:16:39 2013 +0100
+++ b/hgext/graphlog.py	Tue Jan 08 20:37:37 2013 +0100
@@ -39,7 +39,6 @@
      _('show changesets within the given named branch'), _('BRANCH')),
     ('P', 'prune', [],
      _('do not display revision or any of its ancestors'), _('REV')),
-    ('', 'hidden', False, _('show hidden changesets (DEPRECATED)')),
     ] + commands.logopts + commands.walkopts,
     _('[OPTION]... [FILE]'))
 def graphlog(ui, repo, *pats, **opts):
--- a/mercurial/cmdutil.py	Tue Jan 08 21:16:39 2013 +0100
+++ b/mercurial/cmdutil.py	Tue Jan 08 20:37:37 2013 +0100
@@ -1406,8 +1406,6 @@
     # depends on revisions resolved from --rev...
     follow = opts.get('follow') or opts.get('follow_first')
     possiblyunsorted = False # whether revs might need sorting
-    if not opts.get('hidden'):
-        repo = repo.filtered('hidden')
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts['rev'])
         # Don't sort here because _makegraphlogrevset might depend on the
--- a/mercurial/commands.py	Tue Jan 08 21:16:39 2013 +0100
+++ b/mercurial/commands.py	Tue Jan 08 20:37:37 2013 +0100
@@ -49,6 +49,7 @@
     ('', 'profile', None, _('print command execution profile')),
     ('', 'version', None, _('output version information and exit')),
     ('h', 'help', None, _('display help and exit')),
+    ('', 'hidden', False, _('consider hidden changesets')),
 ]
 
 dryrunopts = [('n', 'dry-run', None,
@@ -4091,7 +4092,6 @@
      _('show changesets within the given named branch'), _('BRANCH')),
     ('P', 'prune', [],
      _('do not display revision or any of its ancestors'), _('REV')),
-    ('', 'hidden', False, _('show hidden changesets (DEPRECATED)')),
     ] + logopts + walkopts,
     _('[OPTION]... [FILE]'))
 def log(ui, repo, *pats, **opts):
@@ -4207,8 +4207,6 @@
             return
         if opts.get('branch') and ctx.branch() not in opts['branch']:
             return
-        if not opts.get('hidden') and ctx.hidden():
-            return
         if df and not df(ctx.date()[0]):
             return
 
--- a/mercurial/dispatch.py	Tue Jan 08 21:16:39 2013 +0100
+++ b/mercurial/dispatch.py	Tue Jan 08 20:37:37 2013 +0100
@@ -710,6 +710,10 @@
                 repo = hg.repository(ui, path=path)
                 if not repo.local():
                     raise util.Abort(_("repository '%s' is not local") % path)
+                if not options['hidden']:
+                    repo = repo.filtered('hidden')
+                else:
+                    repo = repo.unfiltered()
                 repo.ui.setconfig("bundle", "mainreporoot", repo.root)
             except error.RequirementError:
                 raise
--- a/tests/test-commit-amend.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-commit-amend.t	Tue Jan 08 20:37:37 2013 +0100
@@ -492,9 +492,9 @@
 ---------------------------------------------------------------------
 
 
-  $ hg id -r 14
+  $ hg id -r 14 --hidden
   b650e6ee8614 (a)
-  $ hg revert -ar 14
+  $ hg revert -ar 14 --hidden
   reverting a
   $ hg commit --amend
   $ hg id
--- a/tests/test-debugcomplete.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-debugcomplete.t	Tue Jan 08 20:37:37 2013 +0100
@@ -123,6 +123,7 @@
   --encoding
   --encodingmode
   --help
+  --hidden
   --noninteractive
   --profile
   --quiet
@@ -153,6 +154,7 @@
   --encodingmode
   --errorlog
   --help
+  --hidden
   --ipv6
   --name
   --noninteractive
@@ -200,7 +202,7 @@
   export: output, switch-parent, rev, text, git, nodates
   forget: include, exclude
   init: ssh, remotecmd, insecure
-  log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
+  log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude
   merge: force, rev, preview, tool
   pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
   push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
--- a/tests/test-extension.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-extension.t	Tue Jan 08 20:37:37 2013 +0100
@@ -200,6 +200,7 @@
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
+      --hidden            consider hidden changesets
   
   [+] marked option can be specified multiple times
 
@@ -230,6 +231,7 @@
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
+      --hidden            consider hidden changesets
   
   [+] marked option can be specified multiple times
   $ echo 'debugextension = !' >> $HGRCPATH
--- a/tests/test-help.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-help.t	Tue Jan 08 20:37:37 2013 +0100
@@ -248,6 +248,7 @@
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
+      --hidden            consider hidden changesets
   
   [+] marked option can be specified multiple times
   
@@ -334,6 +335,7 @@
       --profile           print command execution profile
       --version           output version information and exit
    -h --help              display help and exit
+      --hidden            consider hidden changesets
   
   [+] marked option can be specified multiple times
 
--- a/tests/test-keyword.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-keyword.t	Tue Jan 08 20:37:37 2013 +0100
@@ -576,6 +576,7 @@
 Commit and show expansion in original and copy
 
   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache (unserved): tip differs
   c
    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
   overwriting c expanding keywords
@@ -759,7 +760,6 @@
 | invalid here.
 
   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache: tip differs
   invalid branchheads cache (unserved): tip differs
   a
   invalid branchheads cache: tip differs
@@ -806,7 +806,6 @@
   $ hg remove a
   $ hg --debug commit -m rma
   invalid branchheads cache: tip differs
-  invalid branchheads cache: tip differs
   committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
   $ hg status
   ? c
@@ -917,7 +916,6 @@
   [255]
   $ cd x
   $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache: tip differs
   x/a
    x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
   invalid branchheads cache: tip differs
--- a/tests/test-log.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-log.t	Tue Jan 08 20:37:37 2013 +0100
@@ -1164,7 +1164,7 @@
 
 test that parent prevent a changeset to be hidden
 
-  $ hg up 1 -q
+  $ hg up 1 -q --hidden
   $ hg log --template='{rev}:{node}\n'
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
--- a/tests/test-newbranch.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-newbranch.t	Tue Jan 08 20:37:37 2013 +0100
@@ -136,7 +136,6 @@
   $ cp .hg/bc-invalid $branchcache
 
   $ hg --debug log -r foo
-  invalid branchheads cache: tip differs
   changeset:   4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6
   branch:      foo
   tag:         tip
--- a/tests/test-obsolete-divergent.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-obsolete-divergent.t	Tue Jan 08 20:37:37 2013 +0100
@@ -27,7 +27,7 @@
   >    hg ci -m "$1"
   > }
   $ getid() {
-  >    hg id --debug -ir "desc('$1')"
+  >    hg id --debug --hidden -ir "desc('$1')"
   > }
 
 setup repo
@@ -72,7 +72,7 @@
   |/
   @  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -119,7 +119,7 @@
   |/
   o  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -154,7 +154,7 @@
   |/
   @  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -180,7 +180,7 @@
   $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc
   $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd
 
-  $ hg debugsuccessorssets 'desc('A_0')'
+  $ hg debugsuccessorssets --hidden 'desc('A_0')'
   007dc284c1f8
       392fd25390da
 
@@ -208,7 +208,7 @@
   |/
   o  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -236,7 +236,7 @@
   |/
   @  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -277,7 +277,7 @@
   |/
   o  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -333,7 +333,7 @@
   |/
   @  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -400,7 +400,7 @@
   |/
   @  0:d20a80d4def3 base
   
-  $ hg debugsuccessorssets 'all()'
+  $ hg debugsuccessorssets --hidden 'all()'
   d20a80d4def3
       d20a80d4def3
   007dc284c1f8
@@ -440,7 +440,7 @@
   $ hg debugobsolete `getid A_0` `getid A_2`
   $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
   invalid branchheads cache (unserved): tip differs
-  $ hg debugsuccessorssets 'desc('A_0')'
+  $ hg debugsuccessorssets --hidden 'desc('A_0')'
   007dc284c1f8
       82623d38b9ba 392fd25390da
 
--- a/tests/test-obsolete.t	Tue Jan 08 21:16:39 2013 +0100
+++ b/tests/test-obsolete.t	Tue Jan 08 20:37:37 2013 +0100
@@ -11,7 +11,7 @@
   >    hg ci -m "add $1"
   > }
   $ getid() {
-  >    hg id --debug -ir "desc('$1')"
+  >    hg id --debug --hidden -ir "desc('$1')"
   > }
 
   $ cat > debugkeys.py <<EOF
@@ -130,7 +130,7 @@
 
 Check that public changeset are not accounted as obsolete:
 
-  $ hg phase --public 2
+  $ hg --hidden phase --public 2
   $ hg --config 'extensions.graphlog=' glog
   @  changeset:   5:5601fb93a350
   |  tag:         tip