##// END OF EJS Templates
Fixups for hg grep...
Matt Mackall -
r3523:7ed86c28 default
parent child Browse files
Show More
@@ -298,13 +298,6 b' def write_bundle(cg, filename=None, comp'
298 298 if cleanup is not None:
299 299 os.unlink(cleanup)
300 300
301 def trimuser(ui, name, rev, revcache):
302 """trim the name of the user who committed a change"""
303 user = revcache.get(rev)
304 if user is None:
305 user = revcache[rev] = ui.shortuser(name)
306 return user
307
308 301 class changeset_printer(object):
309 302 '''show changeset information when templating not requested.'''
310 303
@@ -1470,29 +1463,23 b' def grep(ui, repo, pattern, *pats, **opt'
1470 1463 yield ('+', b[i])
1471 1464
1472 1465 prev = {}
1473 ucache = {}
1474 1466 def display(fn, rev, states, prevstates):
1475 1467 counts = {'-': 0, '+': 0}
1476 1468 filerevmatches = {}
1477 1469 if incrementing or not opts['all']:
1478 a, b = prevstates, states
1470 a, b, r = prevstates, states, rev
1479 1471 else:
1480 a, b = states, prevstates
1472 a, b, r = states, prevstates, prev.get(fn, -1)
1481 1473 for change, l in difflinestates(a, b):
1482 if incrementing or not opts['all']:
1483 r = rev
1484 else:
1485 r = prev[fn]
1486 1474 cols = [fn, str(r)]
1487 1475 if opts['line_number']:
1488 1476 cols.append(str(l.linenum))
1489 1477 if opts['all']:
1490 1478 cols.append(change)
1491 1479 if opts['user']:
1492 cols.append(trimuser(ui, getchange(r)[1], rev,
1493 ucache))
1480 cols.append(ui.shortuser(getchange(r)[1]))
1494 1481 if opts['files_with_matches']:
1495 c = (fn, rev)
1482 c = (fn, r)
1496 1483 if c in filerevmatches:
1497 1484 continue
1498 1485 filerevmatches[c] = 1
@@ -9,7 +9,7 b' port:2:1:+:spam:export'
9 9 port:2:2:+:spam:vaportight
10 10 port:2:3:+:spam:import/export
11 11 port:1:2:+:eggs:export
12 port:0:1:+:eggs:import
12 port:0:1:+:spam:import
13 13 port:4:import/export
14 14 % follow
15 15 port:0:import
@@ -22,4 +22,4 b' port:2:1:+:spam:export'
22 22 port:2:2:+:spam:vaportight
23 23 port:2:3:+:spam:import/export
24 24 port:1:2:+:eggs:export
25 port:0:1:+:eggs:import
25 port:0:1:+:spam:import
General Comments 0
You need to be logged in to leave comments. Login now