comparison mercurial/commands.py @ 2626:f84e166eb0de

walkchangerevs: fix race in fast path do not yield revs if the corresponding cl entry does not exists, it avoids a race in the fastpath (where we walk in the filelog) with an ongoing transaction.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 16 Jul 2006 11:32:37 +0200
parents 70d65ca6d893
children 837119f1bf4d b24efed24e8f
comparison
equal deleted inserted replaced
2625:70d65ca6d893 2626:f84e166eb0de
126 # No files, no patterns. Display all revs. 126 # No files, no patterns. Display all revs.
127 wanted = dict(zip(revs, revs)) 127 wanted = dict(zip(revs, revs))
128 if not slowpath: 128 if not slowpath:
129 # Only files, no patterns. Check the history of each file. 129 # Only files, no patterns. Check the history of each file.
130 def filerevgen(filelog): 130 def filerevgen(filelog):
131 cl_count = repo.changelog.count()
131 for i, window in increasing_windows(filelog.count()-1, -1): 132 for i, window in increasing_windows(filelog.count()-1, -1):
132 revs = [] 133 revs = []
133 for j in xrange(i - window, i + 1): 134 for j in xrange(i - window, i + 1):
134 revs.append(filelog.linkrev(filelog.node(j))) 135 revs.append(filelog.linkrev(filelog.node(j)))
135 revs.reverse() 136 revs.reverse()
136 for rev in revs: 137 for rev in revs:
137 yield rev 138 # only yield rev for which we have the changelog, it can
139 # happen while doing "hg log" during a pull or commit
140 if rev < cl_count:
141 yield rev
138 142
139 minrev, maxrev = min(revs), max(revs) 143 minrev, maxrev = min(revs), max(revs)
140 for file_ in files: 144 for file_ in files:
141 filelog = repo.file(file_) 145 filelog = repo.file(file_)
142 # A zero count may be a directory or deleted file, so 146 # A zero count may be a directory or deleted file, so