Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 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 |
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