Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 11609:890ad9d6a169
log: slowpath: do not read the full changelog
When in the slowpath, we are examining _all_ changesets in revs.
We need to order reads so they happen increasingly for I/O performance.
Increasing windows were used to read changelog backwards in a windowed manner,
reading the changelog forward inside each window. But since no revision range
was specified, it was equivalent to reading the full changelog, even if a
single revision was passed to the commandline.
When --removed is used, we _need_ to scan all changesets, but if we're only
looking for file patterns, this is not necessary and we can stick to
the revspec that was given to us.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sun, 04 Jul 2010 18:07:30 +0900 |
parents | 183e63112698 |
children | e8b9942f5254 |
comparison
equal
deleted
inserted
replaced
11608:183e63112698 | 11609:890ad9d6a169 |
---|---|
1104 if follow: | 1104 if follow: |
1105 raise util.Abort(_('can only follow copies/renames for explicit ' | 1105 raise util.Abort(_('can only follow copies/renames for explicit ' |
1106 'filenames')) | 1106 'filenames')) |
1107 | 1107 |
1108 # The slow path checks files modified in every changeset. | 1108 # The slow path checks files modified in every changeset. |
1109 def changerevgen(): | 1109 if opts.get('removed'): |
1110 for i, window in increasing_windows(len(repo) - 1, nullrev): | 1110 # --removed wants to yield the changes where the file |
1111 for j in xrange(i - window, i + 1): | 1111 # was removed, this means that we have to explore all |
1112 yield change(j) | 1112 # changesets, effectively ignoring the revisions that |
1113 | 1113 # had been passed as arguments |
1114 for ctx in changerevgen(): | 1114 revrange = xrange(nullrev, len(repo) - 1) |
1115 else: | |
1116 revrange = sorted(revs) | |
1117 for i in revrange: | |
1118 ctx = change(i) | |
1115 matches = filter(match, ctx.files()) | 1119 matches = filter(match, ctx.files()) |
1116 if matches: | 1120 if matches: |
1117 fncache[ctx.rev()] = matches | 1121 fncache[i] = matches |
1118 wanted.add(ctx.rev()) | 1122 wanted.add(i) |
1119 | 1123 |
1120 class followfilter(object): | 1124 class followfilter(object): |
1121 def __init__(self, onlyfirst=False): | 1125 def __init__(self, onlyfirst=False): |
1122 self.startrev = nullrev | 1126 self.startrev = nullrev |
1123 self.roots = set() | 1127 self.roots = set() |