Skip to content
Snippets Groups Projects

Add a fixer for ExtrinsicRawMetadata

2 unresolved threads

the 'type' attribute has been removed in swh.model v1.0.0 in favor of ExtendedSWHID.

This is needed to be able to replay current journal in staging.


Migrated from D5634 (view on Phabricator)

Merge request reports

Approval is optional

Closed by Phabricator Migration userPhabricator Migration user 3 years ago (Apr 28, 2021 1:00pm UTC)

Merge details

  • The changes were not merged into generated-differential-D645-target.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
297 >>> _fix_raw_extrinsic_metadata({
298 ... 'type': 'directory',
299 ... 'target': 'swh:1:dir:460a586d1c95d120811eaadb398d534e019b5243',
300 ... })
301 {'target': 'swh:1:dir:460a586d1c95d120811eaadb398d534e019b5243'}
302 >>> _fix_raw_extrinsic_metadata({
303 ... 'type': 'origin',
304 ... 'target': 'https://inria.halpreprod.archives-ouvertes.fr/hal-01667309',
305 ... })
306 {'target': 'swh:1:ori:155291d5b9ada4570672510509f93fcfd9809882'}
307
308 """
309 o = obj_dict.copy()
310 if o.pop("type", None) == "origin":
311 o["target"] = str(Origin(o["target"]).swhid())
312 return o
  • vlorentz
    vlorentz @vlorentz started a thread on the diff
  • 291 292
    292 293
    294 def _fix_raw_extrinsic_metadata(obj_dict: Dict) -> Dict:
    295 """Fix legacy RawExtrinsicMetadata with type which is no longer part of the model.
    296
    297 >>> _fix_raw_extrinsic_metadata({
    298 ... 'type': 'directory',
    299 ... 'target': 'swh:1:dir:460a586d1c95d120811eaadb398d534e019b5243',
    300 ... })
    301 {'target': 'swh:1:dir:460a586d1c95d120811eaadb398d534e019b5243'}
    302 >>> _fix_raw_extrinsic_metadata({
    303 ... 'type': 'origin',
    304 ... 'target': 'https://inria.halpreprod.archives-ouvertes.fr/hal-01667309',
    305 ... })
    306 {'target': 'swh:1:ori:155291d5b9ada4570672510509f93fcfd9809882'}
    307
  • Merge request was accepted

  • Antoine R. Dumont approved this merge request

    approved this merge request

  • Author Maintainer

    remove the pprint from the doctest

  • Build is green

    Patch application report for D5634 (id=20109)

    Rebasing onto 615d719c...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 98804f9e1262a74555fac964255cad244db42094
    Author: David Douard <david.douard@sdfa3.org>
    Date:   Wed Apr 28 12:06:19 2021 +0200
    
        Add a fixer for ExtrinsicRawMetadata
        
        the 'type' attribute has been removed in swh.model v1.0.0 in favor of
        an ExtendedSWHID 'target'.

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

  • Author Maintainer

    Merge request was merged

  • closed

  • Please register or sign in to reply
    Loading