mercurial/commands.py
changeset 41739 8ab42ccb68fe
parent 41687 fee1a4935c27
child 41748 980e05204ed8
equal deleted inserted replaced
41738:c70bdd222dcd 41739:8ab42ccb68fe
  2883             fm.context(ctx=ctx)
  2883             fm.context(ctx=ctx)
  2884             fm.data(node=fm.hexfunc(scmutil.binnode(ctx)), path=fn)
  2884             fm.data(node=fm.hexfunc(scmutil.binnode(ctx)), path=fn)
  2885             fm.plain(uipathfn(fn), label='grep.filename')
  2885             fm.plain(uipathfn(fn), label='grep.filename')
  2886 
  2886 
  2887             cols = [
  2887             cols = [
  2888                 ('rev', '%d', rev, not plaingrep),
  2888                 ('rev', '%d', rev, not plaingrep, ''),
  2889                 ('linenumber', '%d', l.linenum, opts.get('line_number')),
  2889                 ('linenumber', '%d', l.linenum, opts.get('line_number'), ''),
  2890             ]
  2890             ]
  2891             if diff:
  2891             if diff:
  2892                 cols.append(('change', '%s', change, True))
  2892                 cols.append(
       
  2893                     ('change', '%s', change, True,
       
  2894                      'grep.inserted ' if change == '+' else 'grep.deleted ')
       
  2895                 )
  2893             cols.extend([
  2896             cols.extend([
  2894                 ('user', '%s', formatuser(ctx.user()), opts.get('user')),
  2897                 ('user', '%s', formatuser(ctx.user()), opts.get('user'), ''),
  2895                 ('date', '%s', fm.formatdate(ctx.date(), datefmt),
  2898                 ('date', '%s', fm.formatdate(ctx.date(), datefmt),
  2896                  opts.get('date')),
  2899                  opts.get('date'), ''),
  2897             ])
  2900             ])
  2898             for name, fmt, data, cond in cols:
  2901             for name, fmt, data, cond, extra_label in cols:
  2899                 if cond:
  2902                 if cond:
  2900                     fm.plain(sep, label='grep.sep')
  2903                     fm.plain(sep, label='grep.sep')
  2901                 field = fieldnamemap.get(name, name)
  2904                 field = fieldnamemap.get(name, name)
  2902                 fm.condwrite(cond, field, fmt, data, label='grep.%s' % name)
  2905                 label = extra_label + ('grep.%s' % name)
       
  2906                 fm.condwrite(cond, field, fmt, data, label=label)
  2903             if not opts.get('files_with_matches'):
  2907             if not opts.get('files_with_matches'):
  2904                 fm.plain(sep, label='grep.sep')
  2908                 fm.plain(sep, label='grep.sep')
  2905                 if not opts.get('text') and binary():
  2909                 if not opts.get('text') and binary():
  2906                     fm.plain(_(" Binary file matches"))
  2910                     fm.plain(_(" Binary file matches"))
  2907                 else:
  2911                 else: