WIP: T360057: Write object changes to different layers - #165
Draft
viktordick wants to merge 47 commits into
Draft
viktordick wants to merge 47 commits into
viktordick wants to merge 47 commits into
Conversation
viktordick
marked this pull request as draft
June 16, 2026 11:44
viktordick
force-pushed
the
360057-layer-edit
branch
from
June 16, 2026 12:16
0799e48 to
64f33ac
Compare
viktordick
force-pushed
the
360057-layer-edit
branch
from
July 16, 2026 14:41
6c87359 to
3d68f50
Compare
When obj.zodbsync_layer disagrees with the object's current filesystem location (file in fallback layer, target is a named layer), write to the target layer and delete __meta__, __source* and __frozen__ from the old location. fs_write is extended to always write when the target layer lacks a __meta__ file, so a data-unchanged move is not silently skipped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
viktordick
force-pushed
the
360057-layer-edit
branch
from
August 6, 2026 07:04
3d68f50 to
b34340f
Compare
added 2 commits
August 6, 2026 09:05
Wiseqube
reviewed
Sep 2, 2026
| def gitcmd(self, *args): | ||
| # use "--no-pager" instead of "-P" for compatibility / readability | ||
| return ["git", "--no-pager", "-C", self.config["base_dir"]] + list(args) | ||
| workdir = getattr(self, "_git_workdir", self.config["base_dir"]) |
Contributor
There was a problem hiding this comment.
_git_workdir should be an attribute on SubCommand itself and initialized during its init from the config. The subclasses are then able to set it to their own value after calling ther super-class constructor
Wiseqube
reviewed
Sep 2, 2026
| parser.add_argument("cmd", type=str, help="""command to be executed""") | ||
|
|
||
| @SubCommand.gitexec | ||
| def _git_run(self, workdir, *args): |
Contributor
There was a problem hiding this comment.
Mhm, these are pure helpers not really connected to the instance itself, so maybe we can just define them as such (helper functions outside of the class)
Wiseqube
reviewed
Sep 2, 2026
| return pathinfo["layers"][pathinfo["layeridx"]]["ident"] | ||
| return "" | ||
|
|
||
| def _clear_src_attrs(self, obj, src_ident, tgt_ident, acquired_ident=None): |
Contributor
There was a problem hiding this comment.
also a helper function without real requirement for "self"
Wiseqube
reviewed
Sep 2, 2026
| pass | ||
| break | ||
|
|
||
| def _delete_layer_files(self, fspath): |
Contributor
There was a problem hiding this comment.
This is called by "external" users (subcommands) so we should not need the _
Wiseqube
reviewed
Sep 2, 2026
Wiseqube
reviewed
Sep 2, 2026
Wiseqube
reviewed
Sep 2, 2026
Bare <commit> (no ident: prefix) now resolves to the named layer whose workdir the cwd is in, if any, matching the behavior already added for exec/checkout/pick. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
recordandwatchdetermine the correct target layer for each object before writing, using the object'szodbsync_layerattribute as the authoritative signal. A newzodbsync movecommand moves an object's filesystem representation between layers and updates the attribute. The__frozen__marker is generalised so it works across named layers, not just the fallback layer.Layer compression (the pass in
fs_writethat removes an object from a layer when a lower-priority layer holds identical content) is scoped to the fallback layer only: a copy in a named layer is never removed by compression, so deliberate layer placement is stable.zodbsync pickgains a--layer <ident>flag that routes the cherry-pick to the named layer's own git repo.zodbsync resetgains a<ident>:<targetref>positional syntax that allows resetting one or more named layers in a single atomic operation — git-resetting each, collecting the union of changed paths across all reset repos, and playing them back in one pass.