Skip to content

WIP: T360057: Write object changes to different layers - #165

Draft
viktordick wants to merge 47 commits into
mainfrom
360057-layer-edit
Draft

viktordick wants to merge 47 commits into
mainfrom
360057-layer-edit

Conversation

@viktordick

@viktordick viktordick commented Jun 16, 2026 •

Copy link
Copy Markdown
Collaborator

record and watch determine the correct target layer for each object before writing, using the object's zodbsync_layer attribute as the authoritative signal. A new zodbsync move command 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_write that 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 pick gains a --layer <ident> flag that routes the cherry-pick to the named layer's own git repo. zodbsync reset gains 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.

@viktordick
viktordick marked this pull request as draft June 16, 2026 11:44
Comment thread perfact/zodbsync/subcommand.py Outdated
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"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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

Comment thread perfact/zodbsync/commands/execute.py Outdated
parser.add_argument("cmd", type=str, help="""command to be executed""")

@SubCommand.gitexec
def _git_run(self, workdir, *args):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread perfact/zodbsync/commands/move.py Outdated
return pathinfo["layers"][pathinfo["layeridx"]]["ident"]
return ""

def _clear_src_attrs(self, obj, src_ident, tgt_ident, acquired_ident=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also a helper function without real requirement for "self"

Comment thread perfact/zodbsync/zodbsync.py Outdated
pass
break

def _delete_layer_files(self, fspath):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called by "external" users (subcommands) so we should not need the _

Comment thread perfact/zodbsync/subcommand.py Outdated
Comment thread perfact/zodbsync/subcommand.py Outdated
Comment thread perfact/zodbsync/subcommand.py Outdated
Viktor Dick and others added 6 commits September 2, 2026 11:39
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>
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