comparison mercurial/cmdutil.py @ 9653:e4de75343743

walkchangerevs: kill window step of iterator
author Matt Mackall <mpm@selenic.com>
date Sun, 25 Oct 2009 18:43:58 -0500
parents 2cb0cab10d2e
children 96fe91be9c1e
comparison
equal deleted inserted replaced
9652:2cb0cab10d2e 9653:e4de75343743
1050 window, we first walk forwards to gather data, then in the desired 1050 window, we first walk forwards to gather data, then in the desired
1051 order (usually backwards) to display it. 1051 order (usually backwards) to display it.
1052 1052
1053 This function returns an iterator. The iterator yields 3-tuples. 1053 This function returns an iterator. The iterator yields 3-tuples.
1054 They will be of one of the following forms: 1054 They will be of one of the following forms:
1055
1056 "window", incrementing, lastrev: stepping through a window,
1057 positive if walking forwards through revs, last rev in the
1058 sequence iterated over - use to reset state for the current window
1059 1055
1060 "add", rev, fns: out-of-order traversal of the given filenames 1056 "add", rev, fns: out-of-order traversal of the given filenames
1061 fns, which changed during revision rev - use to gather data for 1057 fns, which changed during revision rev - use to gather data for
1062 possible display 1058 possible display
1063 1059
1216 else: 1212 else:
1217 def want(rev): 1213 def want(rev):
1218 return rev in wanted 1214 return rev in wanted
1219 1215
1220 for i, window in increasing_windows(0, len(revs)): 1216 for i, window in increasing_windows(0, len(revs)):
1221 yield 'window', revs[0] < revs[-1], revs[-1]
1222 nrevs = [rev for rev in revs[i:i+window] if want(rev)] 1217 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1223 for rev in sorted(nrevs): 1218 for rev in sorted(nrevs):
1224 fns = fncache.get(rev) 1219 fns = fncache.get(rev)
1225 if not fns: 1220 if not fns:
1226 def fns_generator(): 1221 def fns_generator():