Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 17788:9912baaae7df
color: add additional changeset.phase label to log.changeset and log.parent
This allows the user to set different colors for each phase, e.g.
[color]
changeset.public = blue
changeset.draft = green
changeset.secret = red
In addition, this doesn't affect current configuration for custom log.changeset
colors, but rather adds the option for users that want to visually see which
changesets are amendable.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 16 Oct 2012 13:35:58 -0500 |
parents | 434e5bd615fc |
children | 4cfd02c2df9a |
comparison
equal
deleted
inserted
replaced
17787:21503aa02d4f | 17788:9912baaae7df |
---|---|
975 notice = _(' (inactive)') | 975 notice = _(' (inactive)') |
976 if ctx.branch() == repo.dirstate.branch(): | 976 if ctx.branch() == repo.dirstate.branch(): |
977 label = 'branches.current' | 977 label = 'branches.current' |
978 rev = str(ctx.rev()).rjust(31 - encoding.colwidth(ctx.branch())) | 978 rev = str(ctx.rev()).rjust(31 - encoding.colwidth(ctx.branch())) |
979 rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), | 979 rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), |
980 'log.changeset') | 980 'log.changeset changeset.%s' % ctx.phasestr()) |
981 tag = ui.label(ctx.branch(), label) | 981 tag = ui.label(ctx.branch(), label) |
982 if ui.quiet: | 982 if ui.quiet: |
983 ui.write("%s\n" % tag) | 983 ui.write("%s\n" % tag) |
984 else: | 984 else: |
985 ui.write("%s %s%s\n" % (tag, rev, notice)) | 985 ui.write("%s %s%s\n" % (tag, rev, notice)) |
5421 | 5421 |
5422 for p in parents: | 5422 for p in parents: |
5423 # label with log.changeset (instead of log.parent) since this | 5423 # label with log.changeset (instead of log.parent) since this |
5424 # shows a working directory parent *changeset*: | 5424 # shows a working directory parent *changeset*: |
5425 ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), | 5425 ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), |
5426 label='log.changeset') | 5426 label='log.changeset changeset.%s' % p.phasestr()) |
5427 ui.write(' '.join(p.tags()), label='log.tag') | 5427 ui.write(' '.join(p.tags()), label='log.tag') |
5428 if p.bookmarks(): | 5428 if p.bookmarks(): |
5429 marks.extend(p.bookmarks()) | 5429 marks.extend(p.bookmarks()) |
5430 if p.rev() == -1: | 5430 if p.rev() == -1: |
5431 if not len(repo): | 5431 if not len(repo): |
5708 ui.write("%s\n" % t, label='tags.normal') | 5708 ui.write("%s\n" % t, label='tags.normal') |
5709 continue | 5709 continue |
5710 | 5710 |
5711 hn = hexfunc(n) | 5711 hn = hexfunc(n) |
5712 r = "%5d:%s" % (repo.changelog.rev(n), hn) | 5712 r = "%5d:%s" % (repo.changelog.rev(n), hn) |
5713 rev = ui.label(r, 'log.changeset') | 5713 rev = ui.label(r, 'log.changeset changeset.%s' % repo[n].phasestr()) |
5714 spaces = " " * (30 - encoding.colwidth(t)) | 5714 spaces = " " * (30 - encoding.colwidth(t)) |
5715 | 5715 |
5716 tag = ui.label(t, 'tags.normal') | 5716 tag = ui.label(t, 'tags.normal') |
5717 if ui.verbose: | 5717 if ui.verbose: |
5718 if repo.tagtype(t) == 'local': | 5718 if repo.tagtype(t) == 'local': |