graphlog: --branch and --only-branch are the same
authorPatrick Mezard <patrick@mezard.eu>
Thu, 23 Feb 2012 11:21:04 +0100
changeset 16157 4a828d3bc04a
parent 16152 816211dfa3a5
child 16158 e04cc21b01b2
graphlog: --branch and --only-branch are the same Handling the aliasing in fancyopts would be cleaner but I do not want to make this change for stable.
hgext/graphlog.py
tests/test-glog.t
--- a/hgext/graphlog.py	Wed Feb 22 17:41:22 2012 -0600
+++ b/hgext/graphlog.py	Thu Feb 23 11:21:04 2012 +0100
@@ -258,10 +258,16 @@
         'exclude':     ('not file($)', ' and '),
         'include':     ('file($)', ' and '),
         'keyword':     ('keyword($)', ' or '),
-        'only_branch': ('branch($)', ' and '),
         'prune':       ('not ($ or ancestors($))', ' and '),
         'user':        ('user($)', ' or '),
         }
+
+    # branch and only_branch are really aliases and must be handled at
+    # the same time
+    if 'branch' in opts and 'only_branch' in opts:
+        opts = dict(opts)
+        opts['branch'] = opts['branch'] + opts.pop('only_branch')
+
     optrevset = []
     revset = []
     for op, val in opts.iteritems():
--- a/tests/test-glog.t	Wed Feb 22 17:41:22 2012 -0600
+++ b/tests/test-glog.t	Thu Feb 23 11:21:04 2012 +0100
@@ -1433,13 +1433,10 @@
   ('group', ('group', ('func', ('symbol', 'branch'), ('string', 'not-a-branch'))))
   abort: unknown revision 'not-a-branch'!
   abort: unknown revision 'not-a-branch'!
-  $ testlog -b default -b branch
-  ('group', ('group', ('or', ('func', ('symbol', 'branch'), ('string', 'default')), ('func', ('symbol', 'branch'), ('string', 'branch')))))
+  $ testlog -b default -b branch --only-branch branch
+  ('group', ('group', ('or', ('or', ('func', ('symbol', 'branch'), ('string', 'default')), ('func', ('symbol', 'branch'), ('string', 'branch'))), ('func', ('symbol', 'branch'), ('string', 'branch')))))
   $ testlog -k expand -k merge
   ('group', ('group', ('or', ('func', ('symbol', 'keyword'), ('string', 'expand')), ('func', ('symbol', 'keyword'), ('string', 'merge')))))
-  $ hg log -G --only-branch 'something nice'
-  abort: unknown revision 'something nice'!
-  [255]
   $ hg log -G --include 'some file' --exclude 'another file'
   $ hg log -G --follow  --template 'nodetag {rev}\n' | grep nodetag | wc -l
   \s*36 (re)