changeset 29856:37d838e8eb0b

grep: build list of columns without "grep." label prefix Prepares for formatter support. We need field names without "grep.".
author Yuya Nishihara <yuya@tcha.org>
date Thu, 18 Aug 2016 14:23:29 +0900
parents fac24eab65a4
children 0418cdf67efb
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 18 14:09:49 2016 +0900
+++ b/mercurial/commands.py	Thu Aug 18 14:23:29 2016 +0900
@@ -4397,20 +4397,20 @@
         else:
             iter = [('', l) for l in states]
         for change, l in iter:
-            cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')]
+            cols = [(fn, 'filename'), (str(rev), 'rev')]
 
             if opts.get('line_number'):
-                cols.append((str(l.linenum), 'grep.linenumber'))
+                cols.append((str(l.linenum), 'linenumber'))
             if opts.get('all'):
-                cols.append((change, 'grep.change'))
+                cols.append((change, 'change'))
             if opts.get('user'):
-                cols.append((ui.shortuser(ctx.user()), 'grep.user'))
+                cols.append((ui.shortuser(ctx.user()), 'user'))
             if opts.get('date'):
-                cols.append((datefunc(ctx.date()), 'grep.date'))
-            for col, label in cols[:-1]:
-                ui.write(col, label=label)
+                cols.append((datefunc(ctx.date()), 'date'))
+            for col, field in cols[:-1]:
+                ui.write(col, label='grep.%s' % field)
                 ui.write(sep, label='grep.sep')
-            ui.write(cols[-1][0], label=cols[-1][1])
+            ui.write(cols[-1][0], label='grep.%s' % cols[-1][1])
             if not opts.get('files_with_matches'):
                 ui.write(sep, label='grep.sep')
                 if not opts.get('text') and binary():