Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 11608:183e63112698
log: remove increasing windows usage in fastpath
The purpose of increasing windows is to allow backwards iteration on the
filelog at a reasonable cost.
But is it needed?
- if follow is False, we have no reason to iterate backwards.
We basically just want to walk the complete filelog and yield all revisions
within the revision range. We can do this forward or
backwards, as it only reads the index.
- when follow is True, we need to examine the contents of the filelog, and to
do this efficiently we need to read the filelog forward.
And on the other hand, to track ancestors and copies, we need to process
revisions backwards. But is it necessary to use increasing windows
for this?
We can iterate over the complete filelog forward, stack the revisions, and
read the reversed(pile), it does the same thing with a more readable code.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sat, 03 Jul 2010 18:11:15 +0900 |
parents | cc784ad8b3da |
children | 890ad9d6a169 |
comparison
equal
deleted
inserted
replaced
11607:cc784ad8b3da | 11608:183e63112698 |
---|---|
1053 if not slowpath: | 1053 if not slowpath: |
1054 minrev, maxrev = min(revs), max(revs) | 1054 minrev, maxrev = min(revs), max(revs) |
1055 # Only files, no patterns. Check the history of each file. | 1055 # Only files, no patterns. Check the history of each file. |
1056 def filerevgen(filelog, last): | 1056 def filerevgen(filelog, last): |
1057 cl_count = len(repo) | 1057 cl_count = len(repo) |
1058 for i, window in increasing_windows(last, nullrev): | 1058 revs = [] |
1059 revs = [] | 1059 for j in xrange(0, last+1): |
1060 for j in xrange(i - window, i + 1): | 1060 linkrev = filelog.linkrev(j) |
1061 n = filelog.node(j) | 1061 if linkrev < minrev: |
1062 revs.append((filelog.linkrev(j), | 1062 continue |
1063 follow and filelog.renamed(n))) | 1063 # only yield rev for which we have the changelog, it can |
1064 for rev in reversed(revs): | 1064 # happen while doing "hg log" during a pull or commit |
1065 linkrev = rev[0] | 1065 if linkrev > maxrev or linkrev >= cl_count: |
1066 if linkrev > maxrev: | 1066 break |
1067 continue | 1067 n = filelog.node(j) |
1068 if linkrev < minrev: | 1068 revs.append((filelog.linkrev(j), |
1069 return | 1069 follow and filelog.renamed(n))) |
1070 # only yield rev for which we have the changelog, it can | 1070 |
1071 # happen while doing "hg log" during a pull or commit | 1071 for rev in reversed(revs): |
1072 if linkrev < cl_count: | 1072 yield rev |
1073 yield rev | |
1074 def iterfiles(): | 1073 def iterfiles(): |
1075 for filename in match.files(): | 1074 for filename in match.files(): |
1076 yield filename, None | 1075 yield filename, None |
1077 for filename_node in copies: | 1076 for filename_node in copies: |
1078 yield filename_node | 1077 yield filename_node |