Mercurial > hg
changeset 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 | a156ce543a5b |
children | 021d5ac3bec0 |
files | mercurial/commands.py tests/test-debugcomplete.out tests/test-log tests/test-log.out |
diffstat | 4 files changed, 100 insertions(+), 4 deletions(-) [+] |
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,
--- a/tests/test-debugcomplete.out Sat Apr 17 14:32:26 2010 +0200 +++ b/tests/test-debugcomplete.out Sun Apr 18 18:18:19 2010 -0400 @@ -171,7 +171,7 @@ export: output, switch-parent, rev, text, git, nodates forget: include, exclude init: ssh, remotecmd -log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, prune, patch, git, limit, no-merges, style, template, include, exclude +log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, style, template, include, exclude merge: force, rev, preview pull: update, force, rev, branch, ssh, remotecmd push: force, rev, branch, ssh, remotecmd
--- a/tests/test-log Sat Apr 17 14:32:26 2010 +0200 +++ b/tests/test-log Sun Apr 18 18:18:19 2010 -0400 @@ -135,4 +135,34 @@ hg log -u "user1" -u "user2" hg log -u "user3" +cd .. + +hg init branches +cd branches + +echo a > a +hg ci -A -m "commit on default" +hg branch test +echo b > b +hg ci -A -m "commit on test" + +hg up default +echo c > c +hg ci -A -m "commit on default" +hg up test +echo c > c +hg ci -A -m "commit on test" + +echo '% log -b default' +hg log -b default + +echo '% log -b test' +hg log -b test + +echo '% log -b dummy' +hg log -b dummy + +echo '% log -b default -b test' +hg log -b default -b test + exit 0
--- a/tests/test-log.out Sat Apr 17 14:32:26 2010 +0200 +++ b/tests/test-log.out Sun Apr 18 18:18:19 2010 -0400 @@ -324,3 +324,65 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: a +adding a +marked working directory as branch test +adding b +0 files updated, 0 files merged, 1 files removed, 0 files unresolved +adding c +created new head +1 files updated, 0 files merged, 1 files removed, 0 files unresolved +adding c +% log -b default +changeset: 2:c3a4f03cc9a7 +parent: 0:24427303d56f +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on default + +changeset: 0:24427303d56f +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on default + +% log -b test +changeset: 3:f5d8de11c2e2 +branch: test +tag: tip +parent: 1:d32277701ccb +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on test + +changeset: 1:d32277701ccb +branch: test +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on test + +% log -b dummy +% log -b default -b test +changeset: 3:f5d8de11c2e2 +branch: test +tag: tip +parent: 1:d32277701ccb +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on test + +changeset: 2:c3a4f03cc9a7 +parent: 0:24427303d56f +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on default + +changeset: 1:d32277701ccb +branch: test +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on test + +changeset: 0:24427303d56f +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: commit on default +