-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
This is running as expected so far, we'll of course have to have the correct script to make use of this functionality! |
325a5ec
to
f28008d
Compare
There was a problem hiding this 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
.
perfact/zodbsync/subcommand.py
Outdated
@@ -150,12 +151,80 @@ def gitexec(func): | |||
- play back changed objects (diff between old and new HEAD) | |||
- unstash | |||
""" | |||
def _playback_paths(self, paths): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
perfact/zodbsync/subcommand.py
Outdated
dryrun=dryrun, | ||
) | ||
|
||
if not dryrun and phase_cmd and os.path.isfile(phase_cmd): |
There was a problem hiding this comment.
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
.
@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! |
if playback_hook and os.path.isfile(playback_hook): | ||
proc = subprocess.Popen( | ||
playback_hook, stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.