Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 7 additions & 7 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Path of the Zope instance configuration to use to instantiate the application
# object
conf_path = '/var/lib/zope4/ema/etc/zope.conf'
conf_path = "/var/lib/zope4/ema/etc/zope.conf"

# Path to Data.fs which is needed for lookup of object IDs from transaction IDs
# with zodbsync watch
datafs_path = '/var/lib/zope4/zeo/var/Data.fs'
datafs_path = "/var/lib/zope4/zeo/var/Data.fs"

# user that is used to create commits
manager_user = 'perfact'
manager_user = "perfact"

# create the manager user with a default password if not present
create_manager_user = True

# sets the default owner for objects that have no owner in the file system
# representation
default_owner = 'perfact'
default_owner = "perfact"

# use default owner even if we're told otherwise by meta file
force_default_owner = False

# Base directory of the repository
base_dir = '/opt/perfact/dbutils-zoperepo'
base_dir = "/opt/perfact/dbutils-zoperepo"

# default settings for git repos
commit_name = "Zope Developer"
commit_email = "zope-devel@example.de"
commit_message = "Generic commit message."

# email address to send commit summaries of default commits to
#codechange_mail = "zope-devel@example.de"
#codechange_sender = "no-reply-zodbsync-changes@example.de"
# codechange_mail = "zope-devel@example.de"
# codechange_sender = "no-reply-zodbsync-changes@example.de"

# Path to script which is called to define the phases of playback to be
# executed.
Expand Down
1 change: 1 addition & 0 deletions perfact/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
14 changes: 7 additions & 7 deletions perfact/zodbsync/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from .zodbsync import mod_read, mod_write
from .extedit import launch as extedit_launch
from .helpers import obj_modtime, db_modtime
from .helpers import db_modtime, obj_modtime
from .zodbsync import mod_read, mod_write

__all__ = [
'mod_read',
'mod_write',
'obj_modtime',
'db_modtime',
'extedit_launch',
"mod_read",
"mod_write",
"obj_modtime",
"db_modtime",
"extedit_launch",
]
50 changes: 28 additions & 22 deletions perfact/zodbsync/commands/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,54 @@


class Checkout(SubCommand):
'''Switch to another branch'''
"""Switch to another branch"""

@staticmethod
def add_args(parser):
parser.add_argument(
'--skip-errors', action='store_true', default=False,
help='Skip failed objects and continue',
)
parser.add_argument(
'--dry-run', action='store_true', default=False,
help='Only check for conflicts and roll back at the end.',
"--skip-errors",
action="store_true",
default=False,
help="Skip failed objects and continue",
)
parser.add_argument(
'-b', action='store_true', default=False,
help='Create branch.',
"--dry-run",
action="store_true",
default=False,
help="Only check for conflicts and roll back at the end.",
)
parser.add_argument(
'-t', '--track', type=str, help='Set up upstream configuration.'
"-b",
action="store_true",
default=False,
help="Create branch.",
)
parser.add_argument(
'--reset', type=str,
help='Reset branch onto given commit.',
"-t", "--track", type=str, help="Set up upstream configuration."
)
parser.add_argument(
'--rebase', type=str,
help='Rebase branch onto given commit.',
"--reset",
type=str,
help="Reset branch onto given commit.",
)
parser.add_argument(
'branch', type=str,
help='''Branch name'''
"--rebase",
type=str,
help="Rebase branch onto given commit.",
)
parser.add_argument("branch", type=str, help="""Branch name""")

@SubCommand.gitexec
def run(self):
self.logger.info('Checking out %s.' % self.args.branch)
cmd = ['checkout']
self.logger.info("Checking out %s." % self.args.branch)
cmd = ["checkout"]
if self.args.b:
cmd.append('-b')
cmd.append("-b")
cmd.append(self.args.branch)
if self.args.b and self.args.track:
cmd.extend(['--track', self.args.track])
cmd.extend(["--track", self.args.track])
self.gitcmd_run(*cmd)
if self.args.reset:
self.gitcmd_run('reset', '--hard', self.args.reset)
self.gitcmd_run("reset", "--hard", self.args.reset)
if self.args.rebase:
self.gitcmd_run('rebase', self.args.rebase)
self.gitcmd_run("rebase", self.args.rebase)
27 changes: 16 additions & 11 deletions perfact/zodbsync/commands/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@


class Exec(SubCommand):
'''Execute a command and play back any paths changed between old and new
HEAD'''
"""Execute a command and play back any paths changed between old and new
HEAD"""

@staticmethod
def add_args(parser):
parser.add_argument(
'--skip-errors', action='store_true', default=False,
help='Skip failed objects and continue',
)
parser.add_argument(
'--dry-run', action='store_true', default=False,
help='Only check for conflicts and roll back at the end.',
"--skip-errors",
action="store_true",
default=False,
help="Skip failed objects and continue",
)
parser.add_argument(
'--nocd', action='store_true', default=False,
help='Do not cd to git repo for command',
"--dry-run",
action="store_true",
default=False,
help="Only check for conflicts and roll back at the end.",
)
parser.add_argument(
'cmd', type=str, help='''command to be executed'''
"--nocd",
action="store_true",
default=False,
help="Do not cd to git repo for command",
)
parser.add_argument("cmd", type=str, help="""command to be executed""")

@SubCommand.gitexec
def run(self):
Expand Down
26 changes: 14 additions & 12 deletions perfact/zodbsync/commands/fastforward.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@


class FF(SubCommand):
'''
"""
Perform a fast-forward merge to the target commit and apply changed paths
'''
"""

@staticmethod
def add_args(parser):
parser.add_argument(
'--skip-errors', action='store_true', default=False,
help='Skip failed objects and continue',
)
parser.add_argument(
'--dry-run', action='store_true', default=False,
help='Only check for conflicts and roll back at the end.',
"--skip-errors",
action="store_true",
default=False,
help="Skip failed objects and continue",
)
parser.add_argument(
'commit', type=str,
help='''Target commit'''
"--dry-run",
action="store_true",
default=False,
help="Only check for conflicts and roll back at the end.",
)
parser.add_argument("commit", type=str, help="""Target commit""")

@SubCommand.gitexec
def run(self):
target = self.args.commit
self.logger.info('Attempting fast-forward merge to %s.' % target)
self.gitcmd_run('merge', '--ff-only', target)
self.logger.info("Attempting fast-forward merge to %s." % target)
self.gitcmd_run("merge", "--ff-only", target)
11 changes: 7 additions & 4 deletions perfact/zodbsync/commands/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@


class Freeze(SubCommand):
'''Mark paths as frozen and record them'''
"""Mark paths as frozen and record them"""

@staticmethod
def add_args(parser):
parser.add_argument(
'path', type=str, nargs='*',
help='Sub-Path in Data.fs to be frozen',
"path",
type=str,
nargs="*",
help="Sub-Path in Data.fs to be frozen",
)

@SubCommand.with_lock
def run(self):
for path in self.args.path:
fullpath = self.sync.fs_path(path)
os.makedirs(fullpath, exist_ok=True)
with open('{}/__frozen__'.format(fullpath), 'w'):
with open("{}/__frozen__".format(fullpath), "w"):
pass
self.sync.record(paths=self.args.path, recurse=True)
23 changes: 12 additions & 11 deletions perfact/zodbsync/commands/layer_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@
class LayerInit(SubCommand):
"""Register layers from source to work_dir, assuming objects are already in
the Data.FS, but are now to be provided by a new layer."""
subcommand = 'layer-init'

subcommand = "layer-init"

@staticmethod
def add_args(parser):
parser.add_argument(
'ident', type=str, nargs='*',
help='Layer identifier(s). May be * for all',
"ident",
type=str,
nargs="*",
help="Layer identifier(s). May be * for all",
)

@SubCommand.with_lock
def run(self):
layers = {layer['ident']: layer
for layer in self.sync.layers
if layer['ident']}
layers = {layer["ident"]: layer for layer in self.sync.layers if layer["ident"]}
idents = self.args.ident
if idents == ['*']:
if idents == ["*"]:
idents = layers.keys()
for ident in idents:
assert ident in layers, "Invalid ident"
for ident in idents:
layer = layers[ident]
source = layer['source']
target = layer['workdir']
source = layer["source"]
target = layer["workdir"]
self.unpack_source(source, target)
sp.run(['git', 'add', '.'], cwd=target)
sp.run(['git', 'commit', '-m', 'zodbsync layer-init'], cwd=target)
sp.run(["git", "add", "."], cwd=target)
sp.run(["git", "commit", "-m", "zodbsync layer-init"], cwd=target)
Loading