Mercurial > hg
changeset 3523:7ed86c28f1ae
Fixups for hg grep
- kill trimuser function
- remove ucache
- simplify descending logic
- fix files with matches logic
- correct tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Oct 2006 14:04:58 -0500 |
parents | c136c28a425a |
children | a33a9af1ec03 |
files | mercurial/commands.py tests/test-grep.out |
diffstat | 2 files changed, 6 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Oct 25 18:31:49 2006 -0500 +++ b/mercurial/commands.py Thu Oct 26 14:04:58 2006 -0500 @@ -298,13 +298,6 @@ if cleanup is not None: os.unlink(cleanup) -def trimuser(ui, name, rev, revcache): - """trim the name of the user who committed a change""" - user = revcache.get(rev) - if user is None: - user = revcache[rev] = ui.shortuser(name) - return user - class changeset_printer(object): '''show changeset information when templating not requested.''' @@ -1470,29 +1463,23 @@ yield ('+', b[i]) prev = {} - ucache = {} def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: - a, b = prevstates, states + a, b, r = prevstates, states, rev else: - a, b = states, prevstates + a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): - if incrementing or not opts['all']: - r = rev - else: - r = prev[fn] cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']: cols.append(change) if opts['user']: - cols.append(trimuser(ui, getchange(r)[1], rev, - ucache)) + cols.append(ui.shortuser(getchange(r)[1])) if opts['files_with_matches']: - c = (fn, rev) + c = (fn, r) if c in filerevmatches: continue filerevmatches[c] = 1
--- a/tests/test-grep.out Wed Oct 25 18:31:49 2006 -0500 +++ b/tests/test-grep.out Thu Oct 26 14:04:58 2006 -0500 @@ -9,7 +9,7 @@ port:2:2:+:spam:vaportight port:2:3:+:spam:import/export port:1:2:+:eggs:export -port:0:1:+:eggs:import +port:0:1:+:spam:import port:4:import/export % follow port:0:import @@ -22,4 +22,4 @@ port:2:2:+:spam:vaportight port:2:3:+:spam:import/export port:1:2:+:eggs:export -port:0:1:+:eggs:import +port:0:1:+:spam:import