Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 11969:52ec5c813723
color: enable branches support
This commit updates the branches command to use ui.label for the branch names
and the changeset. This implementation allows assigning colors to the four
states of a branch: active, closed, current and inactive. While you can
configure color for the four states, only current and closed have default colors
of green and black bold respectively.
author | Jeremy Whitlock <jcscoobyrs@gmail.com> |
---|---|
date | Wed, 28 Jul 2010 23:05:03 -0600 |
parents | 4532c44bb62d |
children | 1fe4702fe2df |
comparison
equal
deleted
inserted
replaced
11968:66521d25c2a6 | 11969:52ec5c813723 |
---|---|
510 if ui.quiet: | 510 if ui.quiet: |
511 ui.write("%s\n" % encodedtag) | 511 ui.write("%s\n" % encodedtag) |
512 else: | 512 else: |
513 hn = repo.lookup(node) | 513 hn = repo.lookup(node) |
514 if isactive: | 514 if isactive: |
515 label = 'branches.active' | |
515 notice = '' | 516 notice = '' |
516 elif hn not in repo.branchheads(tag, closed=False): | 517 elif hn not in repo.branchheads(tag, closed=False): |
517 if not closed: | 518 if not closed: |
518 continue | 519 continue |
520 label = 'branches.closed' | |
519 notice = _(' (closed)') | 521 notice = _(' (closed)') |
520 else: | 522 else: |
523 label = 'branches.inactive' | |
521 notice = _(' (inactive)') | 524 notice = _(' (inactive)') |
525 if tag == repo.dirstate.branch(): | |
526 label = 'branches.current' | |
522 rev = str(node).rjust(31 - encoding.colwidth(encodedtag)) | 527 rev = str(node).rjust(31 - encoding.colwidth(encodedtag)) |
523 data = encodedtag, rev, hexfunc(hn), notice | 528 rev = ui.label('%s:%s' % (rev, hexfunc(hn)), 'log.changeset') |
524 ui.write("%s %s:%s%s\n" % data) | 529 encodedtag = ui.label(encodedtag, label) |
530 ui.write("%s %s%s\n" % (encodedtag, rev, notice)) | |
525 | 531 |
526 def bundle(ui, repo, fname, dest=None, **opts): | 532 def bundle(ui, repo, fname, dest=None, **opts): |
527 """create a changegroup file | 533 """create a changegroup file |
528 | 534 |
529 Generate a compressed changegroup file collecting changesets not | 535 Generate a compressed changegroup file collecting changesets not |