Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/cli.py
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | def iter_origins(ctx, filename, limit): | ||||
from . import get_archive, get_provenance | from . import get_archive, get_provenance | ||||
from .origin import FileOriginIterator | from .origin import FileOriginIterator | ||||
from .provenance import origin_add | from .provenance import origin_add | ||||
archive = get_archive(**ctx.obj["config"]["archive"]) | archive = get_archive(**ctx.obj["config"]["archive"]) | ||||
provenance = get_provenance(**ctx.obj["config"]["provenance"]) | provenance = get_provenance(**ctx.obj["config"]["provenance"]) | ||||
for origin in FileOriginIterator(filename, archive, limit=limit): | for origin in FileOriginIterator(filename, archive, limit=limit): | ||||
origin_add(provenance, origin) | origin_add(archive, provenance, origin) | ||||
@cli.command(name="find-first") | @cli.command(name="find-first") | ||||
@click.argument("swhid") | @click.argument("swhid") | ||||
@click.pass_context | @click.pass_context | ||||
def find_first(ctx, swhid): | def find_first(ctx, swhid): | ||||
"""Find first occurrence of the requested blob.""" | """Find first occurrence of the requested blob.""" | ||||
from . import get_provenance | from . import get_provenance | ||||
Show All 36 Lines |