Page MenuHomeSoftware Heritage

replay: Simplify FileEditor implementation
ClosedPublic

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

Details

Summary

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

Depends on D8882

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 D8941 (id=32218)

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

Updating 2b80484..301b31e
Fast-forward
 swh/loader/svn/loader.py               |   2 +-
 swh/loader/svn/replay.py               | 281 ++-------------------------------
 swh/loader/svn/svn.py                  |  18 +--
 swh/loader/svn/tests/test_externals.py |  63 ++++++++
 swh/loader/svn/tests/test_loader.py    |  73 +++++++++
 5 files changed, 163 insertions(+), 274 deletions(-)
Changes applied before test
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/362/ for more details.

This revision is now accepted and ready to land.Dec 8 2022, 11:38 AM
ardumont added inline comments.
swh/loader/svn/replay.py
110

maybe we can even drop that method implementation override and let the base one do nothing (if it's not raising by default, i don't recall)?

Neat simplification indeed, congrats \m/.

swh/loader/svn/replay.py
110

subvertpy does not check if the method has been defined so yes it will raise AttributeError when replaying revisions if not defined.