changeset 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 b779319a532b
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jul 16 00:02:05 2006 +0200
+++ b/mercurial/commands.py	Sun Jul 16 11:32:37 2006 +0200
@@ -128,13 +128,17 @@
     if not slowpath:
         # Only files, no patterns.  Check the history of each file.
         def filerevgen(filelog):
+            cl_count = repo.changelog.count()
             for i, window in increasing_windows(filelog.count()-1, -1):
                 revs = []
                 for j in xrange(i - window, i + 1):
                     revs.append(filelog.linkrev(filelog.node(j)))
                 revs.reverse()
                 for rev in revs:
-                    yield rev
+                    # only yield rev for which we have the changelog, it can
+                    # happen while doing "hg log" during a pull or commit
+                    if rev < cl_count:
+                        yield rev
 
         minrev, maxrev = min(revs), max(revs)
         for file_ in files: