Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P153
hglib vs dulwich finding blobs
Active
Public
Actions
Authored by
fiendish
on Apr 4 2017, 4:18 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
# hgrepo and gitrepo are identical except hg and git.
# all times are on a fast SSD
# 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())
hgblobs[data] = (f, c.rev())
# this (better!) takes about 14 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]))
hgblobs[data] = (f, li[0])
# 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. 2374 blobs.
Event Timeline
fiendish
created this paste.
Apr 4 2017, 4:18 PM
2017-04-04 16:18:59 (UTC+2)
fiendish
edited the content of this paste.
(Show Details)
Apr 4 2017, 10:13 PM
2017-04-04 22:13:41 (UTC+2)
fiendish
edited the content of this paste.
(Show Details)
fiendish
edited the content of this paste.
(Show Details)
Apr 4 2017, 10:51 PM
2017-04-04 22:51:02 (UTC+2)
fiendish
edited the content of this paste.
(Show Details)
Apr 21 2017, 3:29 PM
2017-04-21 15:29:46 (UTC+2)
Log In to Comment