diff mercurial/commands.py @ 10957:0d5f139b23c1

commands: Add 'hg log --branch' and deprecate 'hg log --only-branch' Switching to --branch makes log consistent with push/pull and make more sense given the actual behavior of the option (you can specify -b multiple times to include multiple branches). This change also adds some tests for 'hg log -b'.
author Steve Losh <steve@stevelosh.com>
date Sun, 18 Apr 2010 18:18:19 -0400
parents a8486615eece
children 021d5ac3bec0
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Apr 17 14:32:26 2010 +0200
+++ b/mercurial/commands.py	Sun Apr 18 18:18:19 2010 -0400
@@ -2157,6 +2157,8 @@
     if opts["date"]:
         df = util.matchdate(opts["date"])
 
+    opts['branch'] += opts.get('only_branch')
+
     displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
     def prep(ctx, fns):
         rev = ctx.rev()
@@ -2166,7 +2168,7 @@
             return
         if opts.get('only_merges') and len(parents) != 2:
             return
-        if opts.get('only_branch') and ctx.branch() not in opts['only_branch']:
+        if opts.get('branch') and ctx.branch() not in opts['branch']:
             return
         if df and not df(ctx.date()[0]):
             return
@@ -3739,8 +3741,10 @@
           ('', 'removed', None, _('include revisions where files were removed')),
           ('m', 'only-merges', None, _('show only merges')),
           ('u', 'user', [], _('revisions committed by user')),
-          ('b', 'only-branch', [],
-            _('show only changesets within the given named branch')),
+          ('', 'only-branch', [],
+            _('show only changesets within the given named branch (DEPRECATED)')),
+          ('b', 'branch', [],
+            _('show changesets within the given named branch')),
           ('P', 'prune', [],
            _('do not display revision or any of its ancestors')),
          ] + logopts + walkopts,