-def merge(idxlist, bits, table):
- count = 0
- for e in git.idxmerge(idxlist):
- count += 1
- prefix = git.extract_bits(e, bits)
- table[prefix] = count
- yield e
+def check_midx(name):
+ nicename = git.repo_rel(name)
+ log('Checking %s.\n' % path_msg(nicename))
+ try:
+ ix = git.open_idx(name)
+ except git.GitError as e:
+ add_error('%s: %s' % (pathmsg(name), e))
+ return
+ for count,subname in enumerate(ix.idxnames):
+ sub = git.open_idx(os.path.join(os.path.dirname(name), subname))
+ for ecount,e in enumerate(sub):
+ if not (ecount % 1234):
+ qprogress(' %d/%d: %s %d/%d\r'
+ % (count, len(ix.idxnames),
+ git.shorten_hash(subname).decode('ascii'),
+ ecount, len(sub)))
+ if not sub.exists(e):
+ add_error("%s: %s: %s missing from idx"
+ % (path_msg(nicename),
+ git.shorten_hash(subname).decode('ascii'),
+ hexstr(e)))
+ if not ix.exists(e):
+ add_error("%s: %s: %s missing from midx"
+ % (path_msg(nicename),
+ git.shorten_hash(subname).decode('ascii'),
+ hexstr(e)))
+ prev = None
+ for ecount,e in enumerate(ix):
+ if not (ecount % 1234):
+ qprogress(' Ordering: %d/%d\r' % (ecount, len(ix)))
+ if e and prev and not e >= prev:
+ add_error('%s: ordering error: %s < %s'
+ % (nicename, hexstr(e), hexstr(prev)))
+ prev = e