max_pack_size = 1000*1000*1000 # larger packs will slow down pruning
max_pack_objects = 200*1000 # cache memory usage is about 83 bytes per object
-SEEK_END=2 # os.SEEK_END is not defined in python 2.4
verbose = 0
ignore_midx = 0
return sum.digest()
-def _shalist_sort_key(ent):
+def shalist_item_sort_key(ent):
(mode, name, id) = ent
assert(mode+0 == mode)
if stat.S_ISDIR(mode):
def tree_encode(shalist):
"""Generate a git tree object from (mode,name,hash) tuples."""
- shalist = sorted(shalist, key = _shalist_sort_key)
+ shalist = sorted(shalist, key = shalist_item_sort_key)
l = []
for (mode,name,bin) in shalist:
assert(mode)
idx_f.truncate(ofs64_ofs)
idx_f.seek(0)
idx_map = mmap_readwrite(idx_f, close=False)
- idx_f.seek(0, SEEK_END)
+ idx_f.seek(0, os.SEEK_END)
count = _helpers.write_idx(idx_f, idx_map, idx, self.count)
assert(count == self.count)
+ # Sync, since it doesn't look like POSIX guarantees that a
+ # matching FILE* (i.e. idx_f) will see the parallel changes if
+ # we don't.
+ idx_map.flush()
idx_map.close()
idx_f.write(packbin)
if not self.p or self.p.poll() != None:
self._restart()
assert(self.p)
- assert(self.p.poll() == None)
+ poll_result = self.p.poll()
+ assert(poll_result == None)
if self.inprogress:
log('_fast_get: opening %r while %r is open\n'
% (id, self.inprogress))
yield type
for blob in it:
yield blob
- assert(self.p.stdout.readline() == '\n')
+ readline_result = self.p.stdout.readline()
+ assert(readline_result == '\n')
self.inprogress = None
except Exception, e:
it.abort()