mercurial/commands.py
changeset 20837 191a0ae37767
parent 20836 a8b4541bb961
child 20838 fe849868fc5a
equal deleted inserted replaced
20836:a8b4541bb961 20837:191a0ae37767
  3341 
  3341 
  3342     def display(fn, ctx, pstates, states):
  3342     def display(fn, ctx, pstates, states):
  3343         rev = ctx.rev()
  3343         rev = ctx.rev()
  3344         datefunc = ui.quiet and util.shortdate or util.datestr
  3344         datefunc = ui.quiet and util.shortdate or util.datestr
  3345         found = False
  3345         found = False
  3346         filerevmatches = {}
       
  3347         @util.cachefunc
  3346         @util.cachefunc
  3348         def binary():
  3347         def binary():
  3349             flog = getfile(fn)
  3348             flog = getfile(fn)
  3350             return util.binary(flog.read(ctx.filenode(fn)))
  3349             return util.binary(flog.read(ctx.filenode(fn)))
  3351 
  3350 
  3364             if opts.get('user'):
  3363             if opts.get('user'):
  3365                 cols.append((ui.shortuser(ctx.user()), 'grep.user'))
  3364                 cols.append((ui.shortuser(ctx.user()), 'grep.user'))
  3366             if opts.get('date'):
  3365             if opts.get('date'):
  3367                 cols.append((datefunc(ctx.date()), 'grep.date'))
  3366                 cols.append((datefunc(ctx.date()), 'grep.date'))
  3368             if opts.get('files_with_matches'):
  3367             if opts.get('files_with_matches'):
  3369                 c = (fn, rev)
  3368                 if found:
  3370                 if c in filerevmatches:
       
  3371                     continue
  3369                     continue
  3372                 filerevmatches[c] = 1
       
  3373             else:
  3370             else:
  3374                 before = l.line[:l.colstart]
  3371                 before = l.line[:l.colstart]
  3375                 match = l.line[l.colstart:l.colend]
  3372                 match = l.line[l.colstart:l.colend]
  3376                 after = l.line[l.colend:]
  3373                 after = l.line[l.colend:]
  3377             for col, label in cols[:-1]:
  3374             for col, label in cols[:-1]: