changeset 14084:2285e5c97f72

graphlog: fix log -G --prune follow() revset really means '::.' while we want something based on the passed argument. Also, ancestors() revset does not include the parent revisions.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 30 Apr 2011 19:42:00 +0200
parents 2520ebfd9f5c
children 4852753dae36
files hgext/graphlog.py tests/test-glog.t
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Sat Apr 30 19:42:00 2011 +0200
+++ b/hgext/graphlog.py	Sat Apr 30 19:42:00 2011 +0200
@@ -224,13 +224,18 @@
     """Return revset str built of revisions, log options and file patterns.
     """
     opt2revset = dict(only_merges='merge()',
-                      only_branch='branch',
+                      only_branch='branch($)',
                       no_merges='not merge()',
-                      include='file',
-                      exclude='not file',
-                      prune='not follow',
+                      include='file($)',
+                      exclude='not file($)',
+                      prune='not ($ or ancestors($))',
+                      user='user($)',
+                      branch='branch($)',
+                      keyword='keyword($)',
                       follow='follow()',
                       removed='removes("*")')
+    opt2revset = dict((k, v.replace('$', '%(val)r'))
+                      for k,v in opt2revset.iteritems())
     revset = []
     for op, val in opts.iteritems():
         if not val:
@@ -243,7 +248,7 @@
         elif op in ('include', 'exclude', 'user', 'branch', 'keyword',
                     'prune', 'only_branch'):
             for f in val:
-                revset.append('%s(%r)' % (revop, f))
+                revset.append(revop % {'val': f})
         elif op == 'rev':
             revset.extend(val)
 
--- a/tests/test-glog.t	Sat Apr 30 19:42:00 2011 +0200
+++ b/tests/test-glog.t	Sat Apr 30 19:42:00 2011 +0200
@@ -1416,3 +1416,12 @@
   $ hg log -G -d 'brace ) in a date'
   abort: invalid date: 'brace ) in a date'
   [255]
+  $ hg log -G -P 32 --template '{rev}\n'
+  @  36
+  |
+  o  35
+  |
+  o  34
+  |
+  | o  33
+  | |