Page MenuHomeSoftware Heritage

Add CoreSWHID.to_extended()
ClosedPublic

Authored by vlorentz on Feb 26 2021, 3:03 PM.

Details

Reviewers
anlambert
Group Reviewers
Reviewers
Summary

This is a useful shorthand when generating SWHIDs in tests.

Diff Detail

Event Timeline

Build is green

Patch application report for D5160 (id=18448)

Could not rebase; Attempt merge onto 24b653e4c0...

Updating 24b653e..10fadf7
Fast-forward
 swh/model/identifiers.py            |  11 ++
 swh/model/model.py                  | 175 +++++++++++---------
 swh/model/tests/swh_model_data.py   |  13 +-
 swh/model/tests/test_identifiers.py |  47 ++++--
 swh/model/tests/test_model.py       | 311 ++++++++++++------------------------
 5 files changed, 241 insertions(+), 316 deletions(-)
Changes applied before test
commit 10fadf7197a50fc0e8ac95096144edea90f1bbd6
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 26 14:59:43 2021 +0100

    Add CoreSWHID.to_extended()
    
    This is a useful shorthand when generating SWHIDs in tests.

commit 690b58d543edcf62e9c6bade2a1c2cf9a6aa016f
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 26 11:41:03 2021 +0100

    RawExtrinsicMetadata: Use CoreSWHID instead of SWHID for contexts
    
    SWHID is deprecated; and CoreSWHID does not support qualifiers at all,
    so RawExtrinsicMetadata no longer needs to check there are no qualifiers.

commit 0fbefec7d7e833cda24b46c641116af8cc028340
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 26 11:34:38 2021 +0100

    RawExtrinsicMetadata: Use ExtendedSWHID as target and remove type
    
    ExtendedSWHID can identify either a software artifact or an origin,
    so we no longer need Union[SWHID, str].
    
    Therefore, we no longer need the 'type' attribute, as it was only
    used to tell when the target is a SWHID and when it's an origin URL.

commit a934fd55318e9b70c4091780081796bc551566c6
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 26 10:49:10 2021 +0100

    Add a swhid() method to all hashable objects.
    
    It can be handy as a shortcut to build SWHID objects.

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

This revision is now accepted and ready to land.Mar 1 2021, 4:01 PM

Landed as 8e0119962bbf333712fe0bcc829b9fe4732b1511