Page MenuHomeSoftware Heritage

mercurial.cli: Deprecate cli in favor of the generic `swh loader run`
ClosedPublic

Authored by ardumont on Feb 25 2021, 9:58 AM.

Details

Summary

This module is:

  • not referenced in the setup.py (so no simple cli call)
  • not tested
  • using an in-memory storage
  • no longer the canonical way of triggering a mercurial ingestion

Note that this also fixes the visit date cli input. When user provided, this date should
be parsed as a datetime prior to being passed to the loader constructor.

Test Plan

tox for no-regression purpose

and manual run for the actual cli.

$ python3 -m swh.loader.mercurial.cli --visit-date "2016-05-03 15:16:32+00" https://www.mercurial-scm.org/repo/hello
/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/click/core.py:610: DeprecationWarning: Call to deprecated function (or staticmethod) main. (Use `swh loader run mercurial|mercurial_from_disk instead`) -- Deprecated since version 0.4.0.
  return callback(*args, **kwargs)
2021-02-25 10:02:07,775 8487 Load origin 'https://www.mercurial-scm.org/repo/hello' with type 'hg'
2021-02-25 10:02:07,775 8487 Cloning https://www.mercurial-scm.org/repo/hello to /tmp/swh.loader.mercurial.6gndrj0z-8487 with timeout 7200 seconds
2021-02-25 10:02:09,626 8487 Bundling at /tmp/swh.loader.mercurial.6gndrj0z-8487/HG20_none_bundle
2021-02-25 10:02:09,775 8487 Cleanup up working bundle /tmp/swh.loader.mercurial.6gndrj0z-8487/HG20_none_bundle
2021-02-25 10:02:09,775 8487 Cleanup up working directory /tmp/swh.loader.mercurial.6gndrj0z-8487

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

Build is green

Patch application report for D5138 (id=18372)

Could not rebase; Attempt merge onto 9f1243f652...

Updating 9f1243f..5313bf1
Fast-forward
 README.md                     | 115 ++++++++----------------------------------
 swh/loader/mercurial/cli.py   |   9 ++++
 swh/loader/mercurial/utils.py |   4 +-
 3 files changed, 31 insertions(+), 97 deletions(-)
Changes applied before test
commit 5313bf102f93b761c3c30638bdf13a10e45f66ed
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Feb 25 09:55:46 2021 +0100

    mercurial.cli: Deprecate cli in favor of the generic `swh loader run`
    
    This module is:
    - not referenced in the setup.py (so no simple cli call)
    - not tested
    - using an in-memory storage
    - no longer the canonical way of triggering a mercurial ingestion
    
    Note that this also fixes the visit date cli input. When user provided, this date should
    be parsed as a datetime prior to being passed to the loader constructor.

commit 3d5903e7381f3fc8bb352a1a7ce2eefa45d3be90
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Feb 23 18:05:36 2021 +0100

    README: Update to a minimum

See https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/159/ for more details.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/loader/mercurial/cli.py
35–37
48–51
This revision is now accepted and ready to land.Feb 25 2021, 10:31 AM

Adapt according to review

  • fix backtick typo in deprecation warning
  • update the visit date parsing formulation to a simpler and better one

Build is green

Patch application report for D5138 (id=18373)

Could not rebase; Attempt merge onto 9f1243f652...

Updating 9f1243f..caa286e
Fast-forward
 README.md                     | 115 ++++++++----------------------------------
 swh/loader/mercurial/cli.py   |  11 ++--
 swh/loader/mercurial/utils.py |   4 +-
 3 files changed, 30 insertions(+), 100 deletions(-)
Changes applied before test
commit caa286e380b65bb36ca4aee13de370fe04f128c2
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Feb 25 09:55:46 2021 +0100

    mercurial.cli: Deprecate cli in favor of the generic `swh loader run`
    
    This module is:
    - not referenced in the setup.py (so no simple cli call)
    - not tested
    - using an in-memory storage
    - no longer the canonical way of triggering a mercurial ingestion
    
    Note that this also fixes the visit date cli input. When user provided, this date should
    be parsed as a datetime prior to being passed to the loader constructor.

commit 3d5903e7381f3fc8bb352a1a7ce2eefa45d3be90
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Feb 23 18:05:36 2021 +0100

    README: Update to a minimum

See https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/160/ for more details.

Build is green

Patch application report for D5138 (id=18374)

Rebasing onto 9f1243f652...

Current branch diff-target is up to date.
Changes applied before test
commit d8572187e96f1863a7c6e9f061bda5ce4f672641
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Feb 25 09:55:46 2021 +0100

    mercurial.cli: Deprecate cli in favor of the generic `swh loader run`
    
    This module is:
    - not referenced in the setup.py (so no simple cli call)
    - not tested
    - using an in-memory storage
    - no longer the canonical way of triggering a mercurial ingestion
    
    Note that this also fixes the visit date cli input. When user provided, this date should
    be parsed as a datetime prior to being passed to the loader constructor.

See https://jenkins.softwareheritage.org/job/DLDHG/job/tests-on-diff/161/ for more details.