Fix format string bugs in grep

This fixes some format string bugs in grep which cause repo to with
"TypeError: not enough arguments for format string" when grepping and
the output contains a valid Python format string.

Change-Id: Ice8968ea106148d409490e4f71a2833b0cc80816
This commit is contained in:
Sebastian Schmidt 2010-06-02 17:18:13 +02:00 committed by Shawn O. Pearce
parent 7198572dd7
commit feb39d61ef

View File

@ -204,7 +204,7 @@ contain a line that matches both expressions:
else: else:
out.project('--- project %s ---' % project.relpath) out.project('--- project %s ---' % project.relpath)
out.nl() out.nl()
out.write(p.stderr) out.write("%s", p.stderr)
out.nl() out.nl()
continue continue
have_match = True have_match = True
@ -217,17 +217,17 @@ contain a line that matches both expressions:
if have_rev and full_name: if have_rev and full_name:
for line in r: for line in r:
rev, line = line.split(':', 1) rev, line = line.split(':', 1)
out.write(rev) out.write("%s", rev)
out.write(':') out.write(':')
out.project(project.relpath) out.project(project.relpath)
out.write('/') out.write('/')
out.write(line) out.write("%s", line)
out.nl() out.nl()
elif full_name: elif full_name:
for line in r: for line in r:
out.project(project.relpath) out.project(project.relpath)
out.write('/') out.write('/')
out.write(line) out.write("%s", line)
out.nl() out.nl()
else: else:
for line in r: for line in r: