Mercurial > hg
changeset 10346:e2db50cae6e6
commands: don't do too much work for error messages
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sat, 06 Feb 2010 19:33:28 +0100 |
parents | bc2866bdf3e0 |
children | 7516716e56dc |
files | mercurial/commands.py tests/test-bheads.out tests/test-branches.out |
diffstat | 3 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Feb 06 19:00:50 2010 +0100 +++ b/mercurial/commands.py Sat Feb 06 19:33:28 2010 +0100 @@ -1422,26 +1422,27 @@ heads = repo.heads(start) else: + if hideinactive: dagheads = repo.heads(start) decode, encode = encoding.fromlocal, encoding.tolocal branches = set(repo[decode(br)].branch() for br in branchrevs) heads = [] - visitedset = set() + for b in branches: bheads = repo.branchheads(b, start, closed=closed) - if not bheads: - encodedbranch = encode(b) - if not opts.get('rev'): - ui.warn(_("no open branch heads on branch %s\n") - % encodedbranch) - else: - ui.warn(_("no changes on branch %s are reachable from %s\n") - % (encodedbranch, opts.get('rev'))) if hideinactive: bheads = [bhead for bhead in bheads if bhead in dagheads] heads.extend(bheads) + haveheads = set(repo[h].branch() for h in heads) + if branches - haveheads: + headless = ', '.join(encode(b) for b in branches - haveheads) + msg = _('no open branch heads found on branches %s') + if opts.get('rev'): + msg += _(' (started at %s)' % opts['rev']) + ui.warn((msg + '\n') % headless) + if not heads: return 1
--- a/tests/test-bheads.out Sat Feb 06 19:00:50 2010 +0100 +++ b/tests/test-bheads.out Sat Feb 06 19:33:28 2010 +0100 @@ -56,7 +56,7 @@ ------- 7: Adding c branch ======= -no changes on branch c are reachable from 3 +no open branch heads found on branches c (started at 3) 1 ------- 7: Adding c branch @@ -72,7 +72,7 @@ 3: Adding b branch head 1 0 ------- -no changes on branch b are reachable from 7 +no open branch heads found on branches b (started at 7) 1 ======= 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-branches.out Sat Feb 06 19:00:50 2010 +0100 +++ b/tests/test-branches.out Sat Feb 06 19:33:28 2010 +0100 @@ -117,7 +117,7 @@ a 5:d8cbc61dbaa6 (inactive) default 0:19709c5a4e75 (inactive) a branch name much longer than the default justification used by branches 7:10ff5895aa57 -no open branch heads on branch b +no open branch heads found on branches b changeset: 12:2da6583810df branch: b tag: tip @@ -169,6 +169,7 @@ date: Thu Jan 01 00:00:04 1970 +0000 summary: Adding b branch head 2 +no open branch heads found on branches a % branch b changeset: 13:6ac12926b8c3 branch: b