Page MenuHomeSoftware Heritage

utils: Raise ValueError when external definition could not be parsed
ClosedPublic

Authored by anlambert on Dec 7 2022, 5:38 PM.

Details

Summary

Such case can happen when an external definition is malformed.

Previously, the parsed malformed external was added to the directory state
with an empty external URL which could lead to unexpected side effects like
removing all previously exported valid externals.

Depends on D8941

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
Branch
raise-on-non-parsable-external-definition
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 33174
Build 52006: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 52005: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D8942 (id=32219)

Could not rebase; Attempt merge onto 2b80484b8b...

Updating 2b80484..f377e9f
Fast-forward
 swh/loader/svn/loader.py               |   2 +-
 swh/loader/svn/replay.py               | 284 +++------------------------------
 swh/loader/svn/svn.py                  |  18 +--
 swh/loader/svn/tests/test_externals.py | 158 ++++++++++++++++++
 swh/loader/svn/tests/test_loader.py    |  73 +++++++++
 swh/loader/svn/tests/test_utils.py     |  13 ++
 swh/loader/svn/utils.py                |   5 +
 7 files changed, 279 insertions(+), 274 deletions(-)
Changes applied before test
commit f377e9f7cef4e7cc672a5d8de4ec1da99de9080f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Dec 6 16:37:12 2022 +0100

    utils: Raise ValueError when external definition could not be parsed
    
    Such case can happen when an external definition is malformed.
    
    Previously, the parsed malformed external was added to the directory state
    with an empty external URL which could lead to unexpected side effects like
    removing all previously exported valid externals.

commit 301b31e950998df20ce522782e31b649ba6a652f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Nov 23 17:28:16 2022 +0100

    replay: Simplify FileEditor implementation
    
    Instead of maintaining file state based on svn properties across revisions
    replay and trying to reconstruct the same file as with a svn export operation
    after applying text deltas, prefer to simply export the file from the currently
    processed revision when closing the associated file editor.
    
    This greatly simplify the replay module implementation while approximatively
    keeping the same performance as before.
    
    Also add a test that would fail without these changes.
    
    Related to T4673

commit 9f3a5800d208f060949b8fb0f3e9788ab275a384
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Nov 24 11:54:03 2022 +0100

    replay: Do not ignore externals in copyfrom operations
    
    When copying a directory from an ancestor revision, do not ignore
    externals as properties are also copied by subversion so external
    paths must also be exported.

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

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/loader/svn/utils.py
315

as failures probably have weird characters in them

This revision is now accepted and ready to land.Dec 8 2022, 11:33 AM