Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation for hook to define phases of playback during git commands #122

Merged
merged 10 commits into from
Jan 31, 2024

Conversation

Wiseqube
Copy link
Contributor

No description provided.

@Wiseqube Wiseqube marked this pull request as draft October 25, 2023 15:29
@Wiseqube Wiseqube changed the title WIP: Implementation for hook to define phases of playback during git commands Implementation for hook to define phases of playback during git commands Jan 10, 2024
@Wiseqube Wiseqube requested a review from viktordick January 10, 2024 09:16
@Wiseqube
Copy link
Contributor Author

This is running as expected so far, we'll of course have to have the correct script to make use of this functionality!

Copy link
Collaborator

@viktordick viktordick left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. Two suggestions for simplifying the code, see below.

Please also adjust the example config.py that is part of the repo as well as the README.md.

@@ -150,12 +151,80 @@ def gitexec(func):
- play back changed objects (diff between old and new HEAD)
- unstash
"""
def _playback_paths(self, paths):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this embedded function? Could we pull this out of def gitexec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't be a problem, I think this was due to the iterative development. Basically started in the wrapper but soon moved it out but kept it contained inside of gitexec

dryrun=dryrun,
)

if not dryrun and phase_cmd and os.path.isfile(phase_cmd):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please turn this around and by using a negated condition and continue.

@Wiseqube
Copy link
Contributor Author

@viktordick I've adjusted the files according to your review, I also added an entry in the readme, the config and the changelog! Additionally, which is mainly due to the fact that I saw a deprecation warning during the running of the checks I've updated the major versions of the github actions used in our workflows!

@Wiseqube Wiseqube requested a review from viktordick January 29, 2024 14:26
if playback_hook and os.path.isfile(playback_hook):
proc = subprocess.Popen(
playback_hook, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't see that earlier - why do you capture stderr? I think it would be better if the caller would see any error messages on their command line.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For now, I will merge this since I want to build on top of this. I think we should continue the discussion about what to to with stderr here, but that can be done in a later PR. For now, the hook script must not write anything to stderr in the case of success.

perfact/zodbsync/subcommand.py Show resolved Hide resolved
Copy link
Collaborator

@viktordick viktordick left a comment

Choose a reason for hiding this comment

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

LGTM

@viktordick viktordick marked this pull request as ready for review January 31, 2024 09:08
@viktordick viktordick merged commit 780563e into master Jan 31, 2024
3 checks passed
@viktordick viktordick deleted the playback-hook branch January 31, 2024 09:08
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