Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 11615:6dbdf5c5c5bd
Merge with stable
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 19 Jul 2010 00:43:34 +0200 |
parents | 57bdc2239535 0e789549271d |
children | 0c23085f051f |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jul 19 00:43:24 2010 +0200 +++ b/mercurial/commands.py Mon Jul 19 00:43:34 2010 +0200 @@ -152,8 +152,9 @@ for f in funcmap: l = [f(n) for n, dummy in lines] if l: - ml = max(map(len, l)) - pieces.append(["%*s" % (ml, x) for x in l]) + sized = [(x, encoding.colwidth(x)) for x in l] + ml = max([w for x, w in sized]) + pieces.append(["%s%s" % (' ' * (ml - w), x) for x, w in sized]) if pieces: for p, l in zip(zip(*pieces), lines): @@ -2043,9 +2044,9 @@ if multioccur: msg = _("\n[+] marked option can be specified multiple times") if ui.verbose and name != 'shortlist': - opt_output.append((msg, ())) + opt_output.append((msg, None)) else: - opt_output.insert(-1, (msg, ())) + opt_output.insert(-1, (msg, None)) if not name: ui.write(_("\nadditional help topics:\n\n")) @@ -2057,16 +2058,20 @@ ui.write(" %-*s %s\n" % (topics_len, t, desc)) if opt_output: - opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0]) - for first, second in opt_output: - if second: - initindent = ' %-*s ' % (opts_len, first) - hangindent = ' ' * (opts_len + 3) - ui.write('%s\n' % (util.wrap(second, + colwidth = encoding.colwidth + # normalize: (opt or message, desc or None, width of opt) + entries = [desc and (opt, desc, colwidth(opt)) or (opt, None, 0) + for opt, desc in opt_output] + hanging = max([e[2] for e in entries]) + for opt, desc, width in entries: + if desc: + initindent = ' %s%s ' % (opt, ' ' * (hanging - width)) + hangindent = ' ' * (hanging + 3) + ui.write('%s\n' % (util.wrap(desc, initindent=initindent, hangindent=hangindent))) else: - ui.write("%s\n" % first) + ui.write("%s\n" % opt) def identify(ui, repo, source=None, rev=None, num=None, id=None, branch=None, tags=None): @@ -3764,8 +3769,8 @@ Update the repository's working directory to the specified changeset. - If no changeset is specified, attempt to update to the head of the - current branch. If this head is a descendant of the working + If no changeset is specified, attempt to update to the tip of the + current branch. If this changeset is a descendant of the working directory's parent, update to it, otherwise abort. The following rules apply when the working directory contains