Page MenuHomeSoftware Heritage

Add an entrypoint in the setup.py
ClosedPublic

Authored by douardda on Oct 2 2018, 3:15 PM.

Details

Summary

loader: rename bundle20_loader.py as loader.py
cli: add a sw-loader-hg entry point
doc: document new cli command in the README file

Diff Detail

Repository
rDLDHG Mercurial loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Thanks.

I like the cli.
For example, it will help simplify issue reporting to reproduce (instead of using the toplevel as i do).

swh/loader/mercurial/cli.py
44 ↗(On Diff #1406)

I don't know what's better...
This way or importing only the necessary symbols...

Something like:

if hg_archive:
    from .loader import HgArchiveBundle20Loader as HgLoader
    kwargs['archive_path'] = hg_archive
else:
    from .loader import HgBundle20Loader as HgLoader
    kwargs['directory'] = hg_archive

(and then remove the global import at the top of the file).

I guess importing at the top can break sooner than at runtime... (with the import from within the call).

This revision is now accepted and ready to land.Oct 2 2018, 5:10 PM
douardda marked an inline comment as done.

cli: do only import the required loader depending on cli options

This revision was automatically updated to reflect the committed changes.