revset: have all() filter out null revision
authorYuya Nishihara <yuya@tcha.org>
Sat, 10 Jan 2015 14:49:50 +0900
changeset 24202 2de9ee016425
parent 24201 77ef059b3317
child 24203 33c7a94d4dd0
revset: have all() filter out null revision I'm not sure if "all()" should filter out "null", but "all()" is stated as 'the same as "0:tip"' (except that it doesn't reorder the subset, I think.) This patch is intended to avoid exposing a fullreposet to graphmod.dagwalker(), which would result in strange drawing in future version: | o changeset: 0:f8035bb17114 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: add a caused by: parents = sorted(set([p.rev() for p in ctx.parents() if p.rev() in revs])) We cannot add "and p.rev() != nullrev" here because revs may actually include "null" revision.
mercurial/revset.py
tests/test-glog.t
tests/test-revset.t
--- a/mercurial/revset.py	Sat Jan 10 16:41:36 2015 +0900
+++ b/mercurial/revset.py	Sat Jan 10 14:49:50 2015 +0900
@@ -994,7 +994,7 @@
     """
     # i18n: "all" is a keyword
     getargs(x, 0, 0, _("all takes no arguments"))
-    return subset
+    return subset & spanset(repo)  # drop "null" if any
 
 def grep(repo, subset, x):
     """``grep(regex)``
--- a/tests/test-glog.t	Sat Jan 10 16:41:36 2015 +0900
+++ b/tests/test-glog.t	Sat Jan 10 14:49:50 2015 +0900
@@ -2365,4 +2365,14 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
   
 
+should not draw line down to null due to the magic of fullreposet
+
+  $ hg log -G -r 'all()' | tail -6
+  |
+  o  changeset:   0:f8035bb17114
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add a
+  
+
   $ cd ..
--- a/tests/test-revset.t	Sat Jan 10 16:41:36 2015 +0900
+++ b/tests/test-revset.t	Sat Jan 10 14:49:50 2015 +0900
@@ -480,6 +480,9 @@
 Test null revision
   $ log 'ancestors(null)'
   -1
+  $ log 'tip:null and all()' | tail -2
+  1
+  0
 
   $ log 'outgoing()'
   8