mercurial/commands.py
changeset 10816 635d601e8f21
parent 10654 153dd9139b0e
child 10817 2096496b40ec
equal deleted inserted replaced
10815:32b213b9b22c 10816:635d601e8f21
  1351             iter = difflinestates(pstates, states)
  1351             iter = difflinestates(pstates, states)
  1352         else:
  1352         else:
  1353             iter = [('', l) for l in states]
  1353             iter = [('', l) for l in states]
  1354         for change, l in iter:
  1354         for change, l in iter:
  1355             cols = [fn, str(rev)]
  1355             cols = [fn, str(rev)]
       
  1356             before, match, after = None, None, None
  1356             if opts.get('line_number'):
  1357             if opts.get('line_number'):
  1357                 cols.append(str(l.linenum))
  1358                 cols.append(str(l.linenum))
  1358             if opts.get('all'):
  1359             if opts.get('all'):
  1359                 cols.append(change)
  1360                 cols.append(change)
  1360             if opts.get('user'):
  1361             if opts.get('user'):
  1365                 c = (fn, rev)
  1366                 c = (fn, rev)
  1366                 if c in filerevmatches:
  1367                 if c in filerevmatches:
  1367                     continue
  1368                     continue
  1368                 filerevmatches[c] = 1
  1369                 filerevmatches[c] = 1
  1369             else:
  1370             else:
  1370                 cols.append(l.line)
  1371                 before = l.line[:l.colstart]
  1371             ui.write(sep.join(cols), eol)
  1372                 match = l.line[l.colstart:l.colend]
       
  1373                 after = l.line[l.colend:]
       
  1374             ui.write(sep.join(cols))
       
  1375             if before is not None:
       
  1376                 ui.write(sep + before)
       
  1377                 ui.write(match, label='grep.match')
       
  1378                 ui.write(after)
       
  1379             ui.write(eol)
  1372             found = True
  1380             found = True
  1373         return found
  1381         return found
  1374 
  1382 
  1375     skip = {}
  1383     skip = {}
  1376     revfiles = {}
  1384     revfiles = {}