mercurial/commands.py
changeset 20838 fe849868fc5a
parent 20837 191a0ae37767
child 20870 6500a2eebee8
equal deleted inserted replaced
20837:191a0ae37767 20838:fe849868fc5a
  3362                 cols.append((change, 'grep.change'))
  3362                 cols.append((change, 'grep.change'))
  3363             if opts.get('user'):
  3363             if opts.get('user'):
  3364                 cols.append((ui.shortuser(ctx.user()), 'grep.user'))
  3364                 cols.append((ui.shortuser(ctx.user()), 'grep.user'))
  3365             if opts.get('date'):
  3365             if opts.get('date'):
  3366                 cols.append((datefunc(ctx.date()), 'grep.date'))
  3366                 cols.append((datefunc(ctx.date()), 'grep.date'))
  3367             if opts.get('files_with_matches'):
  3367             if not opts.get('files_with_matches'):
  3368                 if found:
       
  3369                     continue
       
  3370             else:
       
  3371                 before = l.line[:l.colstart]
  3368                 before = l.line[:l.colstart]
  3372                 match = l.line[l.colstart:l.colend]
  3369                 match = l.line[l.colstart:l.colend]
  3373                 after = l.line[l.colend:]
  3370                 after = l.line[l.colend:]
  3374             for col, label in cols[:-1]:
  3371             for col, label in cols[:-1]:
  3375                 ui.write(col, label=label)
  3372                 ui.write(col, label=label)
  3383                     ui.write(before)
  3380                     ui.write(before)
  3384                     ui.write(match, label='grep.match')
  3381                     ui.write(match, label='grep.match')
  3385                     ui.write(after)
  3382                     ui.write(after)
  3386             ui.write(eol)
  3383             ui.write(eol)
  3387             found = True
  3384             found = True
       
  3385             if before is None:
       
  3386                 break
  3388         return found
  3387         return found
  3389 
  3388 
  3390     skip = {}
  3389     skip = {}
  3391     revfiles = {}
  3390     revfiles = {}
  3392     matchfn = scmutil.match(repo[None], pats, opts)
  3391     matchfn = scmutil.match(repo[None], pats, opts)