[PATCH 3 of 3] log: do not display hidden changeset

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 15 19:01:09 CDT 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1308182280 -7200
# Node ID a632d1b5a3278d0ff06510b70348ff0628114deb
# Parent  1efefc4bf735471e5999b72f93996c270305e24f
log: do not display hidden changeset

We add a --hidden option to display them.

diff -r 1efefc4bf735 -r a632d1b5a327 mercurial/commands.py
--- 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']
diff -r 1efefc4bf735 -r a632d1b5a327 tests/test-debugcomplete.t
--- 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
diff -r 1efefc4bf735 -r a632d1b5a327 tests/test-log.t
--- 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


More information about the Mercurial-devel mailing list