Mercurial > hg
changeset 10832:420bc8124904
summary: make use of output labeling
The individual pieces of information use the same labels as the commands
they summarize for better cohesion of commands.
author | Eric Eisner <ede@mit.edu> |
---|---|
date | Sun, 04 Apr 2010 21:35:00 -0400 |
parents | 441f5d66da03 |
children | d7b601f1e02c |
files | mercurial/commands.py |
diffstat | 1 files changed, 22 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun Apr 04 22:53:50 2010 -0500 +++ b/mercurial/commands.py Sun Apr 04 21:35:00 2010 -0400 @@ -3079,29 +3079,42 @@ for p in parents: t = ' '.join([t for t in tags if tags[t] == p.node()]) + message = '' if p.rev() == -1: if not len(repo): - t += _(' (empty repository)') + message = _(' (empty repository)') else: - t += _(' (no revision checked out)') - ui.write(_('parent: %d:%s %s\n') % (p.rev(), str(p), t)) + message = _(' (no revision checked out)') + # label with log.changeset (instead of log.parent) since this + # shows a working directory parent *changeset*: + ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), + label='log.changeset') + ui.write(t, label='log.tag') + if message: + ui.write(message) + ui.write('\n') if p.description(): - ui.status(' ' + p.description().splitlines()[0].strip() + '\n') + ui.status(' ' + p.description().splitlines()[0].strip() + '\n', + label='log.summary') branch = ctx.branch() bheads = repo.branchheads(branch) m = _('branch: %s\n') % branch if branch != 'default': - ui.write(m) + ui.write(m, label='log.branch') else: - ui.status(m) + ui.status(m, label='log.branch') st = list(repo.status(unknown=True))[:6] ms = mergemod.mergestate(repo) st.append([f for f in ms if ms[f] == 'u']) - labels = [_('%d modified'), _('%d added'), _('%d removed'), - _('%d deleted'), _('%d unknown'), _('%d ignored'), - _('%d unresolved')] + labels = [ui.label(_('%d modified'), 'status.modified'), + ui.label(_('%d added'), 'status.added'), + ui.label(_('%d removed'), 'status.removed'), + ui.label(_('%d deleted'), 'status.deleted'), + ui.label(_('%d unknown'), 'status.unknown'), + ui.label(_('%d ignored'), 'status.ignored'), + ui.label(_('%d unresolved'), 'resolve.unresolved')] t = [] for s, l in zip(st, labels): if s: