# hgrepo and gitrepo are identical except hg and git.
# I promise the cat+sha1 part doesn't contribute more than a fraction of a second to the hglib time.
# this takes about 20 seconds
hgblobs = {}
for li in hgrepo.log():
c = hgrepo[li]
fs = c.added()+c.modified()
for f in fs:
data = hgrepo.cat([os.path.join(hgrepo.root(), f)], c.rev())
hash = hashlib.sha1(data).hexdigest()
hgblobs[hash] = (f, data)
# this (better) takes about 14.5 seconds
hgblobs = {}
for f in hgrepo.manifest(all=True):
fpath = os.path.join(hgrepo.root(), f)
for li in hgrepo.log(files=[fpath]):
data = hgrepo.cat([fpath], int(li[0]))
hash = hashlib.sha1(data).hexdigest()
hgblobs[hash] = (fpath, data)
# this takes about 3 seconds
gitblobs = [v for k in gitrepo.object_store.packs for v in k.iterobjects() if v.type_name == b'blob']
# There are 1686 revs in the repos.