log: do not display hidden changeset
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 16 Jun 2011 01:58:00 +0200
changeset 14645 e4cfdff6d3f4
parent 14644 f3a40fd7008c
child 14646 001788ef4bbb
log: do not display hidden changeset We add a --hidden option to display them.
mercurial/commands.py
tests/test-debugcomplete.t
tests/test-log.t
--- a/mercurial/commands.py	Thu Jun 16 01:57:59 2011 +0200
+++ b/mercurial/commands.py	Thu Jun 16 01:58:00 2011 +0200
@@ -3345,6 +3345,7 @@
      _('show changesets within the given named branch'), _('BRANCH')),
     ('P', 'prune', [],
      _('do not display revision or any of its ancestors'), _('REV')),
+    ('h', 'hidden', False, _('show hidden changesets')),
     ] + logopts + walkopts,
     _('[OPTION]... [FILE]'))
 def log(ui, repo, *pats, **opts):
@@ -3406,6 +3407,8 @@
             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
         if opts['user'] and not [k for k in opts['user']
--- a/tests/test-debugcomplete.t	Thu Jun 16 01:57:59 2011 +0200
+++ b/tests/test-debugcomplete.t	Thu Jun 16 01:58:00 2011 +0200
@@ -194,7 +194,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, patch, git, limit, no-merges, stat, style, template, include, exclude
+  log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude
   merge: force, tool, rev, preview
   pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
   push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
--- a/tests/test-log.t	Thu Jun 16 01:57:59 2011 +0200
+++ b/tests/test-log.t	Thu Jun 16 01:58:00 2011 +0200
@@ -1138,3 +1138,21 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
+  $ cat > $HGTMP/testhidden.py << EOF
+  > def reposetup(ui, repo):
+  >     for line in repo.opener('hidden'):
+  >         ctx = repo[line.strip()]
+  >         repo.changelog.hiddenrevs.add(ctx.rev())
+  > EOF
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "hidden=$HGTMP/testhidden.py" >> $HGRCPATH
+  $ touch .hg/hidden
+  $ hg log --template='{rev}:{node}\n'
+  1:a765632148dc55d38c35c4f247c618701886cb2f
+  0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
+  $ echo a765632148dc55d38c35c4f247c618701886cb2f > .hg/hidden
+  $ hg log --template='{rev}:{node}\n'
+  0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
+  $ hg log --template='{rev}:{node}\n' --hidden
+  1:a765632148dc55d38c35c4f247c618701886cb2f
+  0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05