[PATCH 1 of 3] graphlog: improve --only-branch handling

Patrick Mezard patrick at mezard.eu
Fri Mar 30 04:25:01 CDT 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1333032908 -7200
# Node ID 272169c7d800e7adad03ee7e5b814b05c42ac24f
# Parent  a740fa28d71830ec091aac936611a91fb8f5393b
graphlog: improve --only-branch handling

The previous code was correct for command line as opts always contains the
default empty lists for --branch and --only-branch options. But calling
graphlog.revset() directly with only --only-branch set would leave it
unprocessed.

diff --git a/hgext/graphlog.py b/hgext/graphlog.py
--- a/hgext/graphlog.py
+++ b/hgext/graphlog.py
@@ -296,9 +296,7 @@
     opts = dict(opts)
     # 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['branch'] = opts['branch'] + opts.pop('only_branch')
-
+    opts['branch'] = opts.get('branch', []) + opts.get('only_branch', [])
     follow = opts.get('follow') or opts.get('follow_first')
     followfirst = opts.get('follow_first')
     if 'follow' in opts:


More information about the Mercurial-devel mailing list