Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
10345:bc2866bdf3e0 | 10346:e2db50cae6e6 |
---|---|
1420 hideinactive, _heads = opts.get('active'), None | 1420 hideinactive, _heads = opts.get('active'), None |
1421 if not branchrevs: | 1421 if not branchrevs: |
1422 heads = repo.heads(start) | 1422 heads = repo.heads(start) |
1423 | 1423 |
1424 else: | 1424 else: |
1425 | |
1425 if hideinactive: | 1426 if hideinactive: |
1426 dagheads = repo.heads(start) | 1427 dagheads = repo.heads(start) |
1427 decode, encode = encoding.fromlocal, encoding.tolocal | 1428 decode, encode = encoding.fromlocal, encoding.tolocal |
1428 branches = set(repo[decode(br)].branch() for br in branchrevs) | 1429 branches = set(repo[decode(br)].branch() for br in branchrevs) |
1429 heads = [] | 1430 heads = [] |
1430 visitedset = set() | 1431 |
1431 for b in branches: | 1432 for b in branches: |
1432 bheads = repo.branchheads(b, start, closed=closed) | 1433 bheads = repo.branchheads(b, start, closed=closed) |
1433 if not bheads: | |
1434 encodedbranch = encode(b) | |
1435 if not opts.get('rev'): | |
1436 ui.warn(_("no open branch heads on branch %s\n") | |
1437 % encodedbranch) | |
1438 else: | |
1439 ui.warn(_("no changes on branch %s are reachable from %s\n") | |
1440 % (encodedbranch, opts.get('rev'))) | |
1441 if hideinactive: | 1434 if hideinactive: |
1442 bheads = [bhead for bhead in bheads if bhead in dagheads] | 1435 bheads = [bhead for bhead in bheads if bhead in dagheads] |
1443 heads.extend(bheads) | 1436 heads.extend(bheads) |
1437 | |
1438 haveheads = set(repo[h].branch() for h in heads) | |
1439 if branches - haveheads: | |
1440 headless = ', '.join(encode(b) for b in branches - haveheads) | |
1441 msg = _('no open branch heads found on branches %s') | |
1442 if opts.get('rev'): | |
1443 msg += _(' (started at %s)' % opts['rev']) | |
1444 ui.warn((msg + '\n') % headless) | |
1444 | 1445 |
1445 if not heads: | 1446 if not heads: |
1446 return 1 | 1447 return 1 |
1447 | 1448 |
1448 heads = sorted((repo[h] for h in heads), key=lambda x: -x.rev()) | 1449 heads = sorted((repo[h] for h in heads), key=lambda x: -x.rev()) |