diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-15 15:18:28 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-15 15:18:28 +0200 |
commit | e837b901dcfac82e864f806c80f4a9cbfdb9c9f3 (patch) | |
tree | 9b9c285df9010e0854d42c077548b8f81d4cdfb8 /lib/git/index/base.py | |
parent | 1d2307532d679393ae067326e4b6fa1a2ba5cc06 (diff) | |
download | gitpython-e837b901dcfac82e864f806c80f4a9cbfdb9c9f3.tar.gz |
Move LazyMixin type to gitdb, index reading now uses file_contents_ro from gitdb as well
Diffstat (limited to 'lib/git/index/base.py')
-rw-r--r-- | lib/git/index/base.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/git/index/base.py b/lib/git/index/base.py index 02ed78ea..b2ba9e5c 100644 --- a/lib/git/index/base.py +++ b/lib/git/index/base.py @@ -6,7 +6,6 @@ """Module containing Index implementation, allowing to perform all kinds of index manipulations such as querying and merging. """ import binascii -import mmap import tempfile import os import sys @@ -44,7 +43,8 @@ from git.utils import ( IndexFileSHA1Writer, LazyMixin, LockedFD, - join_path_native + join_path_native, + file_contents_ro ) @@ -91,7 +91,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): # try memory map for speed lfd = LockedFD(self._file_path) try: - stream = lfd.open(write=False, stream=True) + fd = lfd.open(write=False, stream=False) except OSError: lfd.rollback() # in new repositories, there may be no index, which means we are empty @@ -99,11 +99,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): return # END exception handling - try: - stream = mmap.mmap(stream.fileno(), 0, access=mmap.ACCESS_READ) - except Exception: - pass - # END memory mapping + stream = file_contents_ro(fd, stream=True, allow_mmap=True) try: self._deserialize(stream) |