graphlog: fix log -G option types when translating to revset
authorPatrick Mezard <pmezard@gmail.com>
Sat, 30 Apr 2011 19:42:00 +0200
changeset 14081 8670e3694b85
parent 14080 debe5083a84e
child 14082 176b3abb5b8b
graphlog: fix log -G option types when translating to revset For instance, --keyword is a multiple value option while it was processed as a single value option.
hgext/graphlog.py
tests/test-glog.t
--- a/hgext/graphlog.py	Sat Apr 30 18:53:56 2011 +0200
+++ b/hgext/graphlog.py	Sat Apr 30 19:42:00 2011 +0200
@@ -236,12 +236,12 @@
         revop = opt2revset.get(op, op)
         if op in ('follow', 'only_merges', 'no_merges'):
             revset.append('%s()' % revop)
-        elif op in ("date", "keyword", "remove", "user", "branch",
-                    "only_branch", "prune"):
-            revset.append('%s(%s)' % (op, val))
-        elif op in ('include', 'exclude'):
+        elif op in ('date', 'remove'):
+            revset.append('%s(%s)' % (revop, val))
+        elif op in ('include', 'exclude', 'user', 'branch', 'keyword',
+                    'prune', 'only_branch'):
             for f in val:
-                revset.append('%s(%r)' % (op, f))
+                revset.append('%s(%r)' % (revop, f))
         elif op == 'rev':
             revset.extend(val)
 
--- a/tests/test-glog.t	Sat Apr 30 18:53:56 2011 +0200
+++ b/tests/test-glog.t	Sat Apr 30 19:42:00 2011 +0200
@@ -1393,3 +1393,16 @@
   | | |  date:        Thu Jan 01 00:00:32 1970 +0000
   | | |  summary:     (32) expand
   | | |
+
+Test log -G options
+
+  $ hg log -G -u 'something nice'
+  $ hg log -G -b 'something nice'
+  abort: unknown revision 'something nice'!
+  [255]
+  $ hg log -G -k 'something nice'
+  $ hg log -G --only-branch 'something nice'
+  abort: unknown revision 'something nice'!
+  [255]
+  $ hg log -G --include 'some file' --exclude 'another file'
+