changeset 16431:c85098cdd7df

graphlog: implement --hidden
author Patrick Mezard <patrick@mezard.eu>
date Sat, 14 Apr 2012 10:30:38 +0200
parents 6883c2363f44
children 365bb0fa73a4
files hgext/graphlog.py tests/test-glog.t
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Wed Mar 28 11:42:17 2012 +0200
+++ b/hgext/graphlog.py	Sat Apr 14 10:30:38 2012 +0200
@@ -427,6 +427,10 @@
         # filtered result.
         matched = set(revset.match(repo.ui, expr)(repo, sorted(revs)))
         revs = [r for r in revs if r in matched]
+    if not opts.get('hidden'):
+        # --hidden is still experimental and not worth a dedicated revset
+        # yet. Fortunately, filtering revision number is fast.
+        revs = [r for r in revs if r not in repo.changelog.hiddenrevs]
     return revs, expr, filematcher
 
 def generate(ui, dag, displayer, showparents, edgefn, getrenamed=None,
--- a/tests/test-glog.t	Wed Mar 28 11:42:17 2012 +0200
+++ b/tests/test-glog.t	Sat Apr 14 10:30:38 2012 +0200
@@ -2026,3 +2026,22 @@
           ('string', 'r:')
           ('string', 'd:relpath'))
         ('string', 'p:.'))))
+  $ cd ..
+
+Test --hidden
+
+  $ 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]' >> .hg/hgrc
+  $ echo "hidden=$HGTMP/testhidden.py" >> .hg/hgrc
+  $ hg id --debug -i -r 0 > .hg/hidden
+  $ testlog
+  []
+  []
+  $ testlog --hidden
+  []
+  []