Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/cli.py
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | if profile: | ||||
def exit(): | def exit(): | ||||
pr.disable() | pr.disable() | ||||
pr.dump_stats(profile) | pr.dump_stats(profile) | ||||
atexit.register(exit) | atexit.register(exit) | ||||
@cli.command(name="create") | @cli.command(name="create", deprecated=True) | ||||
@click.option("--name", default=None) | @click.option("--maintenance-db", default=None) | ||||
@click.pass_context | @click.option("--drop/--no-drop", "drop_db", default=False) | ||||
def create(ctx, name): | @click.pass_context | ||||
"""Create new provenance database.""" | def create(ctx, maintenance_db, drop_db): | ||||
from .postgresql.db_utils import connect | """Deprecated, please use: | ||||
swh db create provenance | |||||
# Connect to server without selecting a database | and | ||||
conninfo = ctx.obj["config"]["provenance"]["db"] | swh db init provenance | ||||
conn = connect(conninfo) | instead. | ||||
""" | |||||
if ctx.obj["config"]["provenance"]["cls"] == "ps": | |||||
from .postgresql.provenance import create_database | |||||
create_database(conn, conninfo, name) | |||||
elif ctx.obj["config"]["provenance"]["cls"] == "ps_np": | |||||
from .postgresql_nopath.provenance import create_database | |||||
create_database(conn, conninfo, name) | |||||
else: | |||||
raise NotImplementedError | |||||
@cli.command(name="iter-revisions") | @cli.command(name="iter-revisions") | ||||
@click.argument("filename") | @click.argument("filename") | ||||
@click.option("-l", "--limit", type=int) | @click.option("-l", "--limit", type=int) | ||||
@click.pass_context | @click.pass_context | ||||
def iter_revisions(ctx, filename, limit): | def iter_revisions(ctx, filename, limit): | ||||
# TODO: add file size filtering | # TODO: add file size filtering | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |