comparison 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
comparison
equal deleted inserted replaced
17909:3326fd05eb1f 17910:c8709ff57ff2
5424 5424
5425 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): 5425 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'):
5426 copy = copies.pathcopies(repo[node1], repo[node2]) 5426 copy = copies.pathcopies(repo[node1], repo[node2])
5427 5427
5428 fm = ui.formatter('status', opts) 5428 fm = ui.formatter('status', opts)
5429 format = '%s %s' + end 5429 fmt = '%s' + end
5430 if opts.get('no_status'): 5430 showchar = not opts.get('no_status')
5431 format = '%.0s%s' + end
5432 5431
5433 for state, char, files in changestates: 5432 for state, char, files in changestates:
5434 if state in show: 5433 if state in show:
5435 label = 'status.' + state 5434 label = 'status.' + state
5436 for f in files: 5435 for f in files:
5437 fm.startitem() 5436 fm.startitem()
5438 fm.write("status path", format, char, 5437 fm.condwrite(showchar, 'status', '%s ', char, label=label)
5439 repo.pathto(f, cwd), label=label) 5438 fm.write('path', fmt, repo.pathto(f, cwd), label=label)
5440 if f in copy: 5439 if f in copy:
5441 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), 5440 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd),
5442 label='status.copied') 5441 label='status.copied')
5443 fm.end() 5442 fm.end()
5444 5443