Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 17910:c8709ff57ff2
status: use condwrite to avoid zero-width format string hack
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 06 Nov 2012 17:30:47 -0600 |
parents | ba0a1701c81a |
children | 8a8d1a2fd19d |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Nov 03 14:37:50 2012 -0500 +++ b/mercurial/commands.py Tue Nov 06 17:30:47 2012 -0600 @@ -5426,17 +5426,16 @@ copy = copies.pathcopies(repo[node1], repo[node2]) fm = ui.formatter('status', opts) - format = '%s %s' + end - if opts.get('no_status'): - format = '%.0s%s' + end + fmt = '%s' + end + showchar = not opts.get('no_status') for state, char, files in changestates: if state in show: label = 'status.' + state for f in files: fm.startitem() - fm.write("status path", format, char, - repo.pathto(f, cwd), label=label) + fm.condwrite(showchar, 'status', '%s ', char, label=label) + fm.write('path', fmt, repo.pathto(f, cwd), label=label) if f in copy: fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), label='status.copied')