Skip to content

legacy: move LegacyRepository, LegacyRemoteRepository, RepoObj1 into borg.legacy package, refs #9556#9559

Open
mr-raj12 wants to merge 2 commits intoborgbackup:masterfrom
mr-raj12:legacy-package-phase1-2
Open

legacy: move LegacyRepository, LegacyRemoteRepository, RepoObj1 into borg.legacy package, refs #9556#9559
mr-raj12 wants to merge 2 commits intoborgbackup:masterfrom
mr-raj12:legacy-package-phase1-2

Conversation

@mr-raj12
Copy link
Copy Markdown
Contributor

@mr-raj12 mr-raj12 commented Apr 3, 2026

Description

Moves Borg 1.x legacy code into borg.legacy, refs #9556.

  • legacyrepository.pylegacy/repository.py (git mv)
  • legacyremote.pylegacy/remote.py (git mv)
  • RepoObj1 extracted from repoobj.pylegacy/repoobj.py
  • All consumer imports updated to borg.legacy.* paths
  • repoobj.py keeps a re-export for RepoObj1 since the file still exists for RepoObj

No logic changes. Just file moves, import path updates (.foo..foo), and one logger name fix in the tests.

No stubs at old paths for the moved files, they weren't public API.

Refs #9556

Checklist

  • PR is against master
  • New code has tests
  • Tests pass
  • Commit message references related issue

@mr-raj12 mr-raj12 force-pushed the legacy-package-phase1-2 branch from 8d69edb to c918e35 Compare April 3, 2026 10:57
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.35%. Comparing base (60596bd) to head (15bec44).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
src/borg/legacy/repoobj.py 86.66% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9559      +/-   ##
==========================================
- Coverage   83.36%   83.35%   -0.02%     
==========================================
  Files          87       88       +1     
  Lines       15481    15495      +14     
  Branches     2325     2326       +1     
==========================================
+ Hits        12906    12916      +10     
- Misses       1821     1825       +4     
  Partials      754      754              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
Copy link
Copy Markdown
Member

This is hard to review due to the code moves.

Can you use an approach using git mv (when possible), commit, modify?

@mr-raj12
Copy link
Copy Markdown
Contributor Author

mr-raj12 commented Apr 3, 2026

Sure

@mr-raj12 mr-raj12 force-pushed the legacy-package-phase1-2 branch from c918e35 to 472322e Compare April 3, 2026 21:39
@mr-raj12 mr-raj12 force-pushed the legacy-package-phase1-2 branch from 472322e to 15bec44 Compare April 5, 2026 16:44
@mr-raj12
Copy link
Copy Markdown
Contributor Author

mr-raj12 commented Apr 5, 2026

fixed with git mv, now it shows in a proper way

@ThomasWaldmann
Copy link
Copy Markdown
Member

RepoObj1 is identical, just moved?

@mr-raj12
Copy link
Copy Markdown
Contributor Author

mr-raj12 commented Apr 6, 2026

RepoObj1 is identical, just moved?

yes, the same RepoObj1 with updated relative imports

@mr-raj12
Copy link
Copy Markdown
Contributor Author

mr-raj12 commented Apr 9, 2026

I have updated the description to match what actually landed after the git mv rework.

Two commits:

  • 4db927c: git mv of legacyrepository.py and legacyremote.py into legacy/, import paths adjusted
  • 15bec44: extract RepoObj1 into legacy/repoobj.py, update consumer imports

RepoObj1 is identical, only the imports changed (. to ..) as it's one level deeper now. Couldn't git mv a class out of a file that still has other code, so that one was a manual extract only.

There's still a from .legacy.repoobj import RepoObj1 re-export at the bottom of repoobj.py, all internal imports already use the new path though. Happy to drop it if you'd rather not keep it.

Follow-up PRs I have planned (each separate, building on this):

  • Move the 4 legacy key classes (KeyfileKey, RepoKey, Blake2KeyfileKey, Blake2RepoKey) into borg.legacy.crypto.key, with duplicated base classes so legacy crypto is fully independent of borg.crypto.key
  • Extract LegacyArchives from manifest.py to eliminate the 15+ if not self.legacy: branches in the Archives class
  • Switch remote.py to lazy-import LegacyRepository only inside RepositoryServer.open() when v1_or_v2 is set
  • Move upgrade.py → legacy/upgrade.py (only used by transfer_cmd.py)

After all of this merges, removing borg.legacy is a single directory delete with no impact on v2 code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants