Page MenuHomeSoftware Heritage

common/identifiers: Add SWHIDs contextual information computation
ClosedPublic

Authored by anlambert on May 6 2020, 4:09 PM.

Details

Summary

First diff related to new SWHIds contextual information plugged into swh-web.

It implements the computation of these contextual information based on the
context archived objects are browsed: directory, revision, snapshot or origin.

Next step: add the display of these new SWHIDs in the Permalinks tab of the
web UI and add frontend tests.

Related to T1241
Related to T2330

Diff Detail

Repository
rDWAPPS Web applications
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 D3129 (id=11115)

Rebasing onto c20d4abae8...

Current branch diff-target is up to date.
Changes applied before test
commit 17177049dc1522ee5e0d11e3613161d98df7984d
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed May 6 15:23:18 2020 +0200

    common/identifiers: Add SWHIDs contextual information computation
    
    Implement the computation of new SWHIds contextual information based on the
    context archived objects are browsed: directory, revision, snapshot or origin.
    
    Related to T1241
    Related to T2330

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

ardumont added inline comments.
swh/web/common/identifiers.py
241

What is the purpose of the "empty" swh id info?

320

"J'ai les fils qui se croisent ici" ;)

Seriously though, i have difficulties reading the multiple conditionals.

Why the apparently more complex implementation than before?

swh/web/common/identifiers.py
241

To handle the empty snapshot corner case when browsing the archive. But I intend to improve that later.

320

See https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#qualifiers, there is a lot of possibilities for contextual info based on the browsing context.

For instance, you can browse a content in a directory context or in a snapshot context or in an origin context. The function handles all possible cases.

swh/web/common/identifiers.py
320

For instance, you can browse a content in a directory context or in a snapshot context or in an origin context.

And also in a revision context ;-)

swh/web/common/identifiers.py
320

Thanks.

swh/web/templates/includes/show-swh-ids.html
32–33

swh_id or swhid?

I recall you changed those to no longer use _?

swh/web/templates/includes/show-swh-ids.html
32–33

My loop variable is badly named here, it should be swhid_info instead.

Also I should rename swh_ids to swhids_info and the function get_swh_persistent_ids to get_swhids_info for consistency.

I will update the diff accordingly.

Update: Perform some renaming

Build is green

Patch application report for D3129 (id=11118)

Rebasing onto c20d4abae8...

Current branch diff-target is up to date.
Changes applied before test
commit 561b185a02c15c81b925f70b0040d1d0c24620d5
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed May 6 15:23:18 2020 +0200

    common/identifiers: Add SWHIDs contextual information computation
    
    Implement the computation of new SWHIds contextual information based on the
    context archived objects are browsed: directory, revision, snapshot or origin.
    
    Related to T1241
    Related to T2330

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

looks good to me

(Though, i might have passed rather faster on the last 2 tests at the end of the diff)

swh/web/templates/includes/show-swh-ids.html
48

nice trick i just noticed!

This revision is now accepted and ready to land.May 7 2020, 9:58 AM

Build is green

Patch application report for D3129 (id=11134)

Rebasing onto 486255fea1...

Current branch diff-target is up to date.
Changes applied before test
commit 6d00ef0a2829863816c3423d48868d9830a7f52a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed May 6 15:23:18 2020 +0200

    common/identifiers: Add SWHIDs contextual information computation
    
    Implement the computation of new SWHIds contextual information based on the
    context archived objects are browsed: directory, revision, snapshot or origin.
    
    Related to T1241
    Related to T2330

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