comparison mercurial/cmdutil.py @ 9655:6d7d3f849062

walkchangerevs: internalize ctx caching
author Matt Mackall <mpm@selenic.com>
date Tue, 27 Oct 2009 17:01:32 -0500
parents 96fe91be9c1e
children 2ae3758526d8
comparison
equal deleted inserted replaced
9654:96fe91be9c1e 9655:6d7d3f849062
1037 (rev, util.datestr(results[rev]))) 1037 (rev, util.datestr(results[rev])))
1038 return str(rev) 1038 return str(rev)
1039 1039
1040 raise util.Abort(_("revision matching date not found")) 1040 raise util.Abort(_("revision matching date not found"))
1041 1041
1042 def walkchangerevs(ui, repo, match, change, opts): 1042 def walkchangerevs(ui, repo, match, opts):
1043 '''Iterate over files and the revs in which they changed. 1043 '''Iterate over files and the revs in which they changed.
1044 1044
1045 Callers most commonly need to iterate backwards over the history 1045 Callers most commonly need to iterate backwards over the history
1046 in which they are interested. Doing so has awful (quadratic-looking) 1046 in which they are interested. Doing so has awful (quadratic-looking)
1047 performance, so we use iterators in a "windowed" way. 1047 performance, so we use iterators in a "windowed" way.
1085 defrange = '-1:0' 1085 defrange = '-1:0'
1086 revs = revrange(repo, opts['rev'] or [defrange]) 1086 revs = revrange(repo, opts['rev'] or [defrange])
1087 wanted = set() 1087 wanted = set()
1088 slowpath = match.anypats() or (match.files() and opts.get('removed')) 1088 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1089 fncache = {} 1089 fncache = {}
1090 change = util.cachefunc(repo.changectx)
1090 1091
1091 if not slowpath and not match.files(): 1092 if not slowpath and not match.files():
1092 # No files, no patterns. Display all revs. 1093 # No files, no patterns. Display all revs.
1093 wanted = set(revs) 1094 wanted = set(revs)
1094 copies = [] 1095 copies = []