Skip to content

loader.git.from_disk: Register loader in `swh loader run` cli

This drops the older cli in swh.loader.git.from_disk which was broken and not covered by test.

Related to swh/infra/sysadm-environment#2770 (closed)

Supersedes !53 (closed)

Test Plan

tox happy

And manual check:

$ cd $SWH_ENVIRONMENT_HOME/swh-loader-git
$ pip install -e .
$ swh loader run --help
WARNING:swh.core.cli:Could not load subcommand graph: module 'swh.graph.cli' has no attribute 'cli'
WARNING:swh.core.cli:Could not load subcommand dataset: module 'swh.dataset.cli' has no attribute 'cli'
Usage: swh loader run [OPTIONS] [archive|cran|debian|deposit|git|git_disk|merc
                      urial|nixguix|npm|pypi|svn] URL [OPTIONS]...

  Ingest with loader <type> the origin located at <url>

Options:
  -h, --help  Show this message and exit.

swh loader run git_disk is there alright.

docker:

$ doco up -d  # docker-compose.override.yml with loader-git mount
$ doco exec swh-loader /bin/bash
swh@40b47a9a723a:/$ cd
swh@40b47a9a723a:/$ swh loader run git_disk https://swh/loader.git directory=/src/swh-loader-git/
INFO:swh.loader.git.Loader:Load origin 'https://swh/loader.git' with type 'git'
{'status': 'eventful'}

$ psql service=swh-dev -c "select url from origin where url like 'https://swh/%'"
          url
------------------------
 https://swh/loader.git  # <- right url
(1 row)

unset PAGER; psql service=swh-dev -c "select count(*) from content"
-------
  2719
(1 row)

ok then!


Migrated from D4470 (view on Phabricator)

Merge request reports