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