Skip to content

Commit

Permalink
Use ipfs_patch_dir again to work around ipfs/kubo#2938
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Jul 3, 2016
1 parent 81693c5 commit 068c2c1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ipfs-mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ def merge(root, name, multihash):
return ipfs(['object', 'patch', root, 'add-link', name, multihash])


def ipfs_patch_dir(content, root=None):
def ipfs_patch_dir(content, progress=None):
folder = empty()
for name, multihash in content.items():
if root:
log('[*] adding %r / %s/%s / %r' % (root, folder, multihash, name))
if progress:
progress.increase()
progress.update()
folder = merge(folder, name, multihash)
return folder

Expand Down Expand Up @@ -320,7 +321,7 @@ def files2obj(files, stat_db=None, progress=None):
ipfs_obj['Links'].append(y)
if progress:
progress.increase()
progress.log_n('')
progress.update()

return ipfs_obj

Expand All @@ -336,8 +337,11 @@ def resolve(root, tree, stat_db=None):
total = len(obj['files'].items())
progress = Progress(total)
progress.log_n('[*] resolving %r ... ' % root)
ipfs_obj = files2obj(obj['files'], stat_db=stat_db, progress=progress)
resolved = put(ipfs_obj)

#ipfs_obj = files2obj(obj['files'], stat_db=stat_db, progress=progress)
#resolved = put(ipfs_obj)
resolved = ipfs_patch_dir(obj['files'], progress=progress) # TODO

progress.log(resolved)
progress.finish()

Expand Down

0 comments on commit 068c2c1

Please sign in to comment.