You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Borg 2.x code is tangled with 1.x legacy code across ~15 files. manifest.py has 15+ if not self.legacy: branches in the Archives class alone. legacyrepository.py and legacyremote.py already have "legacy" in the name but sit at the package root. src/borg/legacy/ exists but is empty.
What this does
Move the bulk of 1.x code into src/borg/legacy/. The goal is to eliminate almost every last # legacy comment , some one-liner branches are worse to extract than to keep. But the major classes and branch-heavy code (LegacyRepository, LegacyRemoteRepository, RepoObj1, the 4 legacy key types, the entire Archives legacy path) all move out.
After this:
v2 core modules are mostly free of legacy code
borg transfer --from-borg1 keeps working via borg.legacy
Dropping v1 support later = delete borg.legacy + remove a handful of scattered one-liners
Plan (7 phases)
Each phase is a separate PR.
Phase
What happens
1
git mv of legacyrepository.py + legacyremote.py into legacy/
2
Extract RepoObj1, move legacy key types (KeyfileKey, RepoKey, etc.) into legacy/ with imported base classes
3
Extract LegacyArchives from Archives, remove all self.legacy branches in manifest.py
4
Switch remote.py to lazy-import LegacyRepository only inside RepositoryServer.open()
5
git mv of upgrade.py into legacy/
6
Inventory remaining scattered legacy markers, split what can be split, document what stays
7
Audit and expand test coverage for the borg1 compatibility path — borg transfer --from-borg1, upgrade from borg1, and borg serve with v1 clients; there are some transfer tests already but coverage of the upgrade path is thin
Some scattered one-liners can't be moved like version == 1 checks in archive.py, legacy exit codes in helpers/errors.py, repository.version == 1 in cache.py. As extracting those would mean duplicating entire methods for one branch. They go away when v1 support is dropped.
Constraints
borg transfer --from-borg1 must keep working after every phase
borg serve must handle both v1 and v2 clients (lazy import in RepositoryServer.open())
Problem
Borg 2.x code is tangled with 1.x legacy code across ~15 files.
manifest.pyhas 15+if not self.legacy:branches in theArchivesclass alone.legacyrepository.pyandlegacyremote.pyalready have "legacy" in the name but sit at the package root.src/borg/legacy/exists but is empty.What this does
Move the bulk of 1.x code into
src/borg/legacy/. The goal is to eliminate almost every last# legacycomment , some one-liner branches are worse to extract than to keep. But the major classes and branch-heavy code (LegacyRepository, LegacyRemoteRepository, RepoObj1, the 4 legacy key types, the entire Archives legacy path) all move out.After this:
borg transfer --from-borg1keeps working viaborg.legacyborg.legacy+ remove a handful of scattered one-linersPlan (7 phases)
Each phase is a separate PR.
git mvoflegacyrepository.py+legacyremote.pyintolegacy/RepoObj1, move legacy key types (KeyfileKey,RepoKey, etc.) intolegacy/with imported base classesLegacyArchivesfromArchives, remove allself.legacybranches inmanifest.pyremote.pyto lazy-importLegacyRepositoryonly insideRepositoryServer.open()git mvofupgrade.pyintolegacy/borg transfer --from-borg1, upgrade from borg1, andborg servewith v1 clients; there are some transfer tests already but coverage of the upgrade path is thindone:
Target structure
Some scattered one-liners can't be moved like
version == 1checks inarchive.py, legacy exit codes inhelpers/errors.py,repository.version == 1incache.py. As extracting those would mean duplicating entire methods for one branch. They go away when v1 support is dropped.Constraints
borg transfer --from-borg1must keep working after every phaseborg servemust handle both v1 and v2 clients (lazy import inRepositoryServer.open())git mvfor whole-file moves (per feedback on legacy: move LegacyRepository, LegacyRemoteRepository, RepoObj1 into borg.legacy package, refs #9556 #9559). Re-exports only where the original file still has v2 code (repoobj.py)Testing
python -m pytest src/borg/testsuite/ -x -v python -m pytest src/borg/testsuite/ -x -v -k "transfer"