graphlog: fix log -G --prune
authorPatrick Mezard <pmezard@gmail.com>
Sat, 30 Apr 2011 19:42:00 +0200
changeset 14084 2285e5c97f72
parent 14083 2520ebfd9f5c
child 14085 4852753dae36
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.
hgext/graphlog.py
tests/test-glog.t
--- 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
+  | |