Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
10956:a156ce543a5b | 10957:0d5f139b23c1 |
---|---|
2155 | 2155 |
2156 df = False | 2156 df = False |
2157 if opts["date"]: | 2157 if opts["date"]: |
2158 df = util.matchdate(opts["date"]) | 2158 df = util.matchdate(opts["date"]) |
2159 | 2159 |
2160 opts['branch'] += opts.get('only_branch') | |
2161 | |
2160 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) | 2162 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) |
2161 def prep(ctx, fns): | 2163 def prep(ctx, fns): |
2162 rev = ctx.rev() | 2164 rev = ctx.rev() |
2163 parents = [p for p in repo.changelog.parentrevs(rev) | 2165 parents = [p for p in repo.changelog.parentrevs(rev) |
2164 if p != nullrev] | 2166 if p != nullrev] |
2165 if opts.get('no_merges') and len(parents) == 2: | 2167 if opts.get('no_merges') and len(parents) == 2: |
2166 return | 2168 return |
2167 if opts.get('only_merges') and len(parents) != 2: | 2169 if opts.get('only_merges') and len(parents) != 2: |
2168 return | 2170 return |
2169 if opts.get('only_branch') and ctx.branch() not in opts['only_branch']: | 2171 if opts.get('branch') and ctx.branch() not in opts['branch']: |
2170 return | 2172 return |
2171 if df and not df(ctx.date()[0]): | 2173 if df and not df(ctx.date()[0]): |
2172 return | 2174 return |
2173 if opts['user'] and not [k for k in opts['user'] if k in ctx.user()]: | 2175 if opts['user'] and not [k for k in opts['user'] if k in ctx.user()]: |
2174 return | 2176 return |
3737 ('k', 'keyword', [], _('do case-insensitive search for a keyword')), | 3739 ('k', 'keyword', [], _('do case-insensitive search for a keyword')), |
3738 ('r', 'rev', [], _('show the specified revision or range')), | 3740 ('r', 'rev', [], _('show the specified revision or range')), |
3739 ('', 'removed', None, _('include revisions where files were removed')), | 3741 ('', 'removed', None, _('include revisions where files were removed')), |
3740 ('m', 'only-merges', None, _('show only merges')), | 3742 ('m', 'only-merges', None, _('show only merges')), |
3741 ('u', 'user', [], _('revisions committed by user')), | 3743 ('u', 'user', [], _('revisions committed by user')), |
3742 ('b', 'only-branch', [], | 3744 ('', 'only-branch', [], |
3743 _('show only changesets within the given named branch')), | 3745 _('show only changesets within the given named branch (DEPRECATED)')), |
3746 ('b', 'branch', [], | |
3747 _('show changesets within the given named branch')), | |
3744 ('P', 'prune', [], | 3748 ('P', 'prune', [], |
3745 _('do not display revision or any of its ancestors')), | 3749 _('do not display revision or any of its ancestors')), |
3746 ] + logopts + walkopts, | 3750 ] + logopts + walkopts, |
3747 _('[OPTION]... [FILE]')), | 3751 _('[OPTION]... [FILE]')), |
3748 "manifest": | 3752 "manifest": |