' used by %s\n') % (n, mxf))
broken = True
if broken:
+ mx.close()
del mx
unlink(full)
else:
elif not ix.force_keep:
debug1('midx: removing redundant: %s\n'
% os.path.basename(ix.name))
+ ix.close()
unlink(ix.name)
for full in glob.glob(os.path.join(self.dir,'*.idx')):
if not d.get(full):
def __init__(self, filename):
self.name = filename
self.force_keep = False
+ self.map = None
assert(filename.endswith('.midx'))
self.map = mmap_read(open(filename))
if str(self.map[0:4]) != 'MIDX':
self.whichlist = buffer(self.map, self.which_ofs, nsha*4)
self.idxnames = str(self.map[self.which_ofs + 4*nsha:]).split('\0')
+ def __del__(self):
+ self.close()
+
def _init_failed(self):
self.bits = 0
self.entries = 1
def _get_idxname(self, i):
return self.idxnames[self._get_idx_i(i)]
+ def close(self):
+ if self.map is not None:
+ self.map.close()
+ self.map = None
+
def exists(self, hash, want_source=False):
"""Return nonempty if the object exists in the index files."""
global _total_searches, _total_steps