# HG changeset patch # User Matt Mackall # Date 2014-04-07 19:18:10 # Node ID 469d949a7cb8d20e0fee7464c3b12dcac1e55d4c # Parent e9725e18bdf8eaebbdd3a5a4b4dba66e615d5574 revlog: deal with chunk ranges over 2G on Windows (issue4215) Python uses a C long (32 bits on Windows 64) rather than an ssize_t in read(), and thus has a 2G size limit. Work around this by falling back to reading one chunk at a time on overflow. This approximately doubles our headroom until we run back into the size limit on single reads. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -909,8 +909,13 @@ class revlog(object): ladd = l.append # preload the cache - self._chunkraw(revs[0], revs[-1]) - offset, data = self._chunkcache + try: + self._chunkraw(revs[0], revs[-1]) + offset, data = self._chunkcache + except OverflowError: + # issue4215 - we can't cache a run of chunks greater than + # 2G on Windows + return [self._chunk(rev) for rev in revs] for rev in revs: chunkstart = start(rev)