def import_tags(sess, store):
    for tag in sess.query(Tag).all():
        try:
            repos_name = tag.repository.name
            tag_name = tag.name
            repos_namespace = tag.repository.user.username
            image_id = tag.revision.id
            path = store.tag_path(repos_namespace, repos_name, tag_name)
            if store.exists(path):
                continue
            dest = store.put_content(path, image_id)
            print('{0} -> {1}'.format(dest, image_id))
        except __HOLE__ as e:
            print('# Warning: {0}'.format(e))
dataset/ETHPy150Open docker/docker-registry/scripts/import_old_tags.py/import_tags