From: Avery Pennarun Date: Mon, 1 Mar 2010 00:07:00 +0000 (-0500) Subject: Rename PackIndex->PackIdx and MultiPackIndex->PackIdxList. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2116dbc8c010d07b518088197f26726f7c1ebab5;p=packages%2Fb%2Fbup.git Rename PackIndex->PackIdx and MultiPackIndex->PackIdxList. This corresponds to the PackMidx renaming I did earlier, and helps avoid confusion between index.py (which talks to the 'bupindex' file and has nothing to do with packs) and git.py (which talks to packs and has nothing to do with the bupindex). Now pack indexes are always called Idx, and the bupindex is always Index. Furthermore, MultiPackIndex could easily be assumed to be the same thing as a Midx, which it isn't. PackIdxList is a more accurate description of what it is: a list of pack indexes. A Midx is an index of a list of packs. --- diff --git a/cmd/margin-cmd.py b/cmd/margin-cmd.py index 85b3289..2564027 100755 --- a/cmd/margin-cmd.py +++ b/cmd/margin-cmd.py @@ -16,7 +16,7 @@ if extra: git.check_repo_or_die() #git.ignore_midx = 1 -mi = git.MultiPackIndex(git.repo('objects/pack')) +mi = git.PackIdxList(git.repo('objects/pack')) last = '\0'*20 longmatch = 0 for i in mi: diff --git a/cmd/memtest-cmd.py b/cmd/memtest-cmd.py index cf106e4..7ad09e5 100755 --- a/cmd/memtest-cmd.py +++ b/cmd/memtest-cmd.py @@ -40,7 +40,7 @@ if extra: git.ignore_midx = opt.ignore_midx git.check_repo_or_die() -m = git.MultiPackIndex(git.repo('objects/pack')) +m = git.PackIdxList(git.repo('objects/pack')) cycles = opt.cycles or 100 number = opt.number or 10000 diff --git a/cmd/midx-cmd.py b/cmd/midx-cmd.py index 8711111..490a34d 100755 --- a/cmd/midx-cmd.py +++ b/cmd/midx-cmd.py @@ -25,7 +25,7 @@ def do_midx(outdir, outfilename, infilenames): inp = [] total = 0 for name in infilenames: - ix = git.PackIndex(name) + ix = git.PackIdx(name) inp.append(ix) total += len(ix) @@ -100,7 +100,7 @@ elif opt.auto or opt.force: if opt.force: do_midx(path, opt.output, glob.glob('%s/*.idx' % path)) elif opt.auto: - m = git.MultiPackIndex(path) + m = git.PackIdxList(path) needed = {} for pack in m.packs: # only .idx files without a .midx are open if pack.name.endswith('.idx'): diff --git a/cmd/server-cmd.py b/cmd/server-cmd.py index 59459d1..3fea0a9 100755 --- a/cmd/server-cmd.py +++ b/cmd/server-cmd.py @@ -30,7 +30,7 @@ def send_index(conn, name): git.check_repo_or_die() assert(name.find('/') < 0) assert(name.endswith('.idx')) - idx = git.PackIndex(git.repo('objects/pack/%s' % name)) + idx = git.PackIdx(git.repo('objects/pack/%s' % name)) conn.write(struct.pack('!I', len(idx.map))) conn.write(idx.map) conn.ok() diff --git a/lib/bup/client.py b/lib/bup/client.py index 6df1358..cbd007a 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -142,7 +142,7 @@ class Client: self._busy = None #self.sync_indexes() self._busy = ob - return git.MultiPackIndex(self.cachedir) + return git.PackIdxList(self.cachedir) def _suggest_pack(self, indexname): log('received index suggestion: %s\n' % indexname) diff --git a/lib/bup/git.py b/lib/bup/git.py index c755dc5..4c5a6ac 100644 --- a/lib/bup/git.py +++ b/lib/bup/git.py @@ -81,7 +81,7 @@ def _decode_packobj(buf): return (type, zlib.decompress(buf[i+1:])) -class PackIndex: +class PackIdx: def __init__(self, filename): self.name = filename self.map = mmap_read(open(filename)) @@ -201,7 +201,7 @@ class PackMidx: _mpi_count = 0 -class MultiPackIndex: +class PackIdxList: def __init__(self, dir): global _mpi_count assert(_mpi_count == 0) # these things suck tons of VM; don't waste it @@ -269,9 +269,9 @@ class MultiPackIndex: for f in os.listdir(self.dir): full = os.path.join(self.dir, f) if f.endswith('.idx') and not d.get(full): - self.packs.append(PackIndex(full)) + self.packs.append(PackIdx(full)) d[full] = 1 - log('MultiPackIndex: using %d index%s.\n' + log('PackIdxList: using %d index%s.\n' % (len(self.packs), len(self.packs)!=1 and 'es' or '')) def add(self, hash): @@ -337,7 +337,7 @@ class PackWriter: if self.objcache_maker: self.objcache = self.objcache_maker() else: - self.objcache = MultiPackIndex(repo('objects/pack')) + self.objcache = PackIdxList(repo('objects/pack')) def _open(self): if not self.file: diff --git a/t/tgit.py b/t/tgit.py index f43ab53..2ff71ba 100644 --- a/t/tgit.py +++ b/t/tgit.py @@ -42,7 +42,7 @@ def testpacks(): WVPASS(os.path.exists(nameprefix + '.pack')) WVPASS(os.path.exists(nameprefix + '.idx')) - r = git.PackIndex(nameprefix + '.idx') + r = git.PackIdx(nameprefix + '.idx') print repr(r.fanout) for i in range(nobj): @@ -56,7 +56,7 @@ def testpacks(): WVFAIL(r.find_offset('\0'*20)) - r = git.MultiPackIndex('pybuptest.tmp/objects/pack') + r = git.PackIdxList('pybuptest.tmp/objects/pack') WVPASS(r.exists(hashes[5])) WVPASS(r.exists(hashes[6])) WVFAIL(r.exists('\0'*20))