Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 9675:ee913987e4b0
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names
We don't need a "local-charset" aware branchmap() function, we can convert the
names when needed during the output.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 31 Oct 2009 00:31:08 +0100 |
parents | 1de5ebfa5585 |
children | e2b1de5fee04 |
comparison
equal
deleted
inserted
replaced
9674:603b23c6967b | 9675:ee913987e4b0 |
---|---|
448 | 448 |
449 Use the command 'hg update' to switch to an existing branch. | 449 Use the command 'hg update' to switch to an existing branch. |
450 """ | 450 """ |
451 | 451 |
452 hexfunc = ui.debugflag and hex or short | 452 hexfunc = ui.debugflag and hex or short |
453 activebranches = [encoding.tolocal(repo[n].branch()) | 453 activebranches = [repo[n].branch() for n in repo.heads()] |
454 for n in repo.heads()] | |
455 def testactive(tag, node): | 454 def testactive(tag, node): |
456 realhead = tag in activebranches | 455 realhead = tag in activebranches |
457 open = node in repo.branchheads(tag, closed=False) | 456 open = node in repo.branchheads(tag, closed=False) |
458 return realhead and open | 457 return realhead and open |
459 branches = sorted([(testactive(tag, node), repo.changelog.rev(node), tag) | 458 branches = sorted([(testactive(tag, node), repo.changelog.rev(node), tag) |
460 for tag, node in repo.branchtags().items()], | 459 for tag, node in repo.branchtags().items()], |
461 reverse=True) | 460 reverse=True) |
462 | 461 |
463 for isactive, node, tag in branches: | 462 for isactive, node, tag in branches: |
464 if (not active) or isactive: | 463 if (not active) or isactive: |
464 encodedtag = encoding.tolocal(tag) | |
465 if ui.quiet: | 465 if ui.quiet: |
466 ui.write("%s\n" % tag) | 466 ui.write("%s\n" % encodedtag) |
467 else: | 467 else: |
468 hn = repo.lookup(node) | 468 hn = repo.lookup(node) |
469 if isactive: | 469 if isactive: |
470 notice = '' | 470 notice = '' |
471 elif hn not in repo.branchheads(tag, closed=False): | 471 elif hn not in repo.branchheads(tag, closed=False): |
472 if not closed: | 472 if not closed: |
473 continue | 473 continue |
474 notice = ' (closed)' | 474 notice = ' (closed)' |
475 else: | 475 else: |
476 notice = ' (inactive)' | 476 notice = ' (inactive)' |
477 rev = str(node).rjust(31 - encoding.colwidth(tag)) | 477 rev = str(node).rjust(31 - encoding.colwidth(encodedtag)) |
478 data = tag, rev, hexfunc(hn), notice | 478 data = encodedtag, rev, hexfunc(hn), notice |
479 ui.write("%s %s:%s%s\n" % data) | 479 ui.write("%s %s:%s%s\n" % data) |
480 | 480 |
481 def bundle(ui, repo, fname, dest=None, **opts): | 481 def bundle(ui, repo, fname, dest=None, **opts): |
482 """create a changegroup file | 482 """create a changegroup file |
483 | 483 |
1399 if hideinactive: | 1399 if hideinactive: |
1400 _heads = repo.heads(start) | 1400 _heads = repo.heads(start) |
1401 heads = [] | 1401 heads = [] |
1402 visitedset = set() | 1402 visitedset = set() |
1403 for branchrev in branchrevs: | 1403 for branchrev in branchrevs: |
1404 branch = repo[branchrev].branch() | 1404 branch = repo[encoding.fromlocal(branchrev)].branch() |
1405 encodedbranch = encoding.tolocal(branch) | |
1405 if branch in visitedset: | 1406 if branch in visitedset: |
1406 continue | 1407 continue |
1407 visitedset.add(branch) | 1408 visitedset.add(branch) |
1408 bheads = repo.branchheads(branch, start, closed=closed) | 1409 bheads = repo.branchheads(branch, start, closed=closed) |
1409 if not bheads: | 1410 if not bheads: |
1410 if not opts.get('rev'): | 1411 if not opts.get('rev'): |
1411 ui.warn(_("no open branch heads on branch %s\n") % branch) | 1412 ui.warn(_("no open branch heads on branch %s\n") % encodedbranch) |
1412 elif branch != branchrev: | 1413 elif branch != branchrev: |
1413 ui.warn(_("no changes on branch %s containing %s are " | 1414 ui.warn(_("no changes on branch %s containing %s are " |
1414 "reachable from %s\n") | 1415 "reachable from %s\n") |
1415 % (branch, branchrev, opts.get('rev'))) | 1416 % (encodedbranch, branchrev, opts.get('rev'))) |
1416 else: | 1417 else: |
1417 ui.warn(_("no changes on branch %s are reachable from %s\n") | 1418 ui.warn(_("no changes on branch %s are reachable from %s\n") |
1418 % (branch, opts.get('rev'))) | 1419 % (encodedbranch, opts.get('rev'))) |
1419 if hideinactive: | 1420 if hideinactive: |
1420 bheads = [bhead for bhead in bheads if bhead in _heads] | 1421 bheads = [bhead for bhead in bheads if bhead in _heads] |
1421 heads.extend(bheads) | 1422 heads.extend(bheads) |
1422 if not heads: | 1423 if not heads: |
1423 return 1 | 1424 return 1 |