Page MenuHomeSoftware Heritage

algos/revisions_walker: Handle case of revision without committer date
ClosedPublic

Authored by anlambert on Oct 21 2021, 5:18 PM.

Details

Summary

Some revisions in the archive do not have committer date so workaround
it to avoid errors when walking on such revisions when using the class
CommitterDateRevisionsWalker.

Related sentry issue.

Depends on D6532

Diff Detail

Repository
rDSTO Storage manager
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 D6533 (id=23751)

Could not rebase; Attempt merge onto a986710477...

Updating a9867104..ba63438d
Fast-forward
 swh/storage/algos/revisions_walker.py            |  10 +-
 swh/storage/tests/algos/test_revisions_walker.py | 273 +++++++++++++----------
 2 files changed, 161 insertions(+), 122 deletions(-)
Changes applied before test
commit ba63438d6dd1015a63bbcccaaa91e6e2b792218c
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 21 17:12:32 2021 +0200

    algos/revisions_walker: Handle case of revision without committer date
    
    Some revisions in the archive do not have committer date so workaround
    it to avoid errors when walking on such revisions when using the class
    CommitterDateRevisionsWalker.

commit c02be8ebacf311d1aa758cbaf62f25c3dbd7f673
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 21 16:50:57 2021 +0200

    test_revisions_walker: Migrate from unittest to pytest

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

ardumont added inline comments.
swh/storage/algos/revisions_walker.py
240

i don't get the else instruction here.

What does the length of _revs_to_visit have to do with the commit time?

swh/storage/algos/revisions_walker.py
240

Nothing but it enables to iterate on a commit before its parents.

Nevertheless, in practice revisions with no committer date do not have any parents,
see https://archive.softwareheritage.org/api/1/revision/8245c4221d53415eea90b1a0e2d51a2270e42b33/ for instance.

swh/storage/algos/revisions_walker.py
238–239

Thanks! maybe that formulation would be clearer then?

240

thx, i've proposed another formulation above ;)

This revision is now accepted and ready to land.Oct 22 2021, 11:35 AM

Build is green

Patch application report for D6533 (id=23761)

Could not rebase; Attempt merge onto a986710477...

Updating a9867104..49a932c9
Fast-forward
 swh/storage/algos/revisions_walker.py            |  10 +-
 swh/storage/tests/algos/test_revisions_walker.py | 273 +++++++++++++----------
 2 files changed, 161 insertions(+), 122 deletions(-)
Changes applied before test
commit 49a932c98936163435ddda03ffa74fd3f9925fbd
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 21 17:12:32 2021 +0200

    algos/revisions_walker: Handle case of revision without committer date
    
    Some revisions in the archive do not have committer date so workaround
    it to avoid errors when walking on such revisions when using the class
    CommitterDateRevisionsWalker.

commit c02be8ebacf311d1aa758cbaf62f25c3dbd7f673
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Oct 21 16:50:57 2021 +0200

    test_revisions_walker: Migrate from unittest to pytest

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