Show More
@@ -2867,7 +2867,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
2867 | except error.WdirUnsupported: |
|
2867 | except error.WdirUnsupported: | |
2868 | return ctx[fn].isbinary() |
|
2868 | return ctx[fn].isbinary() | |
2869 |
|
2869 | |||
2870 |
fieldnamemap = { |
|
2870 | fieldnamemap = {'linenumber': 'lineno'} | |
2871 | if diff: |
|
2871 | if diff: | |
2872 | iter = difflinestates(pstates, states) |
|
2872 | iter = difflinestates(pstates, states) | |
2873 | else: |
|
2873 | else: | |
@@ -2876,9 +2876,9 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
2876 | fm.startitem() |
|
2876 | fm.startitem() | |
2877 | fm.context(ctx=ctx) |
|
2877 | fm.context(ctx=ctx) | |
2878 | fm.data(node=fm.hexfunc(scmutil.binnode(ctx))) |
|
2878 | fm.data(node=fm.hexfunc(scmutil.binnode(ctx))) | |
|
2879 | fm.write('path', '%s', fn, label='grep.filename') | |||
2879 |
|
2880 | |||
2880 | cols = [ |
|
2881 | cols = [ | |
2881 | ('filename', '%s', fn, True), |
|
|||
2882 | ('rev', '%d', rev, not plaingrep), |
|
2882 | ('rev', '%d', rev, not plaingrep), | |
2883 | ('linenumber', '%d', l.linenum, opts.get('line_number')), |
|
2883 | ('linenumber', '%d', l.linenum, opts.get('line_number')), | |
2884 | ] |
|
2884 | ] | |
@@ -2889,13 +2889,11 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
2889 | ('date', '%s', fm.formatdate(ctx.date(), datefmt), |
|
2889 | ('date', '%s', fm.formatdate(ctx.date(), datefmt), | |
2890 | opts.get('date')), |
|
2890 | opts.get('date')), | |
2891 | ]) |
|
2891 | ]) | |
2892 | lastcol = next( |
|
|||
2893 | name for name, fmt, data, cond in reversed(cols) if cond) |
|
|||
2894 | for name, fmt, data, cond in cols: |
|
2892 | for name, fmt, data, cond in cols: | |
|
2893 | if cond: | |||
|
2894 | fm.plain(sep, label='grep.sep') | |||
2895 | field = fieldnamemap.get(name, name) |
|
2895 | field = fieldnamemap.get(name, name) | |
2896 | fm.condwrite(cond, field, fmt, data, label='grep.%s' % name) |
|
2896 | fm.condwrite(cond, field, fmt, data, label='grep.%s' % name) | |
2897 | if cond and name != lastcol: |
|
|||
2898 | fm.plain(sep, label='grep.sep') |
|
|||
2899 | if not opts.get('files_with_matches'): |
|
2897 | if not opts.get('files_with_matches'): | |
2900 | fm.plain(sep, label='grep.sep') |
|
2898 | fm.plain(sep, label='grep.sep') | |
2901 | if not opts.get('text') and binary(): |
|
2899 | if not opts.get('text') and binary(): |
General Comments 0
You need to be logged in to leave comments.
Login now