Page MenuHomeSoftware Heritage

replay: Copy dir states and external paths in copy_from operations
ClosedPublic

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

Details

Summary

Copied directories might have externals so we also need to copy states
and update external paths in case externals list is later modified.

Depends on D8943

Diff Detail

Repository
rDLDSVN Subversion (SVN) loader
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 D8944 (id=32221)

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

Updating 2b80484..b016f65
Fast-forward
 swh/loader/svn/loader.py               |   2 +-
 swh/loader/svn/replay.py               | 306 +++++----------------------------
 swh/loader/svn/svn.py                  |  22 +--
 swh/loader/svn/tests/test_externals.py | 170 ++++++++++++++++++
 swh/loader/svn/tests/test_loader.py    |  87 +++++++++-
 swh/loader/svn/tests/test_utils.py     |  13 ++
 swh/loader/svn/utils.py                |   5 +
 7 files changed, 323 insertions(+), 282 deletions(-)
Changes applied before test
commit b016f654397d50711ea03d19ef8b7fcb73f006df
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Dec 7 17:16:44 2022 +0100

    replay: Copy dir states and external paths in copy_from operations
    
    Copied directories might have externals so we also need to copy states
    and update external paths in case externals list is later modified.

commit fc78f57464df7fbcc7020115fd928712c413a156
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Dec 7 11:28:46 2022 +0100

    svn: Use urllib.parse.quote to percent encode svn URLs
    
    In order to detect all ascii characters that must be percent encoded
    in svn URLs, add a brute force test and use urllib.parse.quote in
    quote_svn_url function.

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/365/ for more details.

Are you sure the path argument to add_directory cannot start with a / or contain ..?

Are you sure the path argument to add_directory cannot start with a / or contain ..?

Yes it cannot happen.

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