# HG changeset patch # User Nicolas Dumazet # Date 2010-07-04 09:07:30 # Node ID 890ad9d6a16950cfd6d952bde7887d301568b763 # Parent 183e63112698586e73ff7772470c65b78ee3ee22 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. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1106,16 +1106,20 @@ def walkchangerevs(repo, match, opts, pr 'filenames')) # The slow path checks files modified in every changeset. - def changerevgen(): - for i, window in increasing_windows(len(repo) - 1, nullrev): - for j in xrange(i - window, i + 1): - yield change(j) - - for ctx in changerevgen(): + if opts.get('removed'): + # --removed wants to yield the changes where the file + # was removed, this means that we have to explore all + # changesets, effectively ignoring the revisions that + # had been passed as arguments + revrange = xrange(nullrev, len(repo) - 1) + else: + revrange = sorted(revs) + for i in revrange: + ctx = change(i) matches = filter(match, ctx.files()) if matches: - fncache[ctx.rev()] = matches - wanted.add(ctx.rev()) + fncache[i] = matches + wanted.add(i) class followfilter(object): def __init__(self, onlyfirst=False):