-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add support for default branch detection #254
Add support for default branch detection #254
Conversation
@@ -51,6 +51,8 @@ def __init__(self, pr_remote, commit_sha1, branches, | |||
if dry_run: | |||
click.echo("Dry run requested, listing expected command sequence") | |||
|
|||
self.remember_current_branch() |
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.
The method is called only once, let's inline it.
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.
I think named things are better readable within the code flow, don't you?
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.
Well, I don't care too much.
My the only objection is the call hides _start_branch
initialization by moving attribute assignment from constructor to method.
Also, cherry-picker doesn't use underscores for attribute names.
Let's rename self._start_branch
for consistency.
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.
Yeah, I've also had this concern and then saw this pattern being used all over the place. I think, I can simplify this.
@@ -104,6 +106,7 @@ def run_cmd(self, cmd): | |||
return | |||
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | |||
click.echo(output.decode('utf-8')) | |||
return output |
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.
There the function's result is used?
I don't see any application.
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.
Yeah, it was used in the previous commit. Now it's not.
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.
This does not work in case we have merge conflict, and have to proceed using --continue
option.
I'm thinking that the memorized branch should be saved as part of config file, at the start of cherry picking. And later cleared after --abort
and --continue
Based on suggestions of @serhiy-storchaka @terryjreedy in python#250: Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
f09b0fd
to
5a7efe8
Compare
Fair enough! I've changed it as suggested and added doc to readme. |
And fix test name shaddowing
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.
Looks great! Thanks! 🌮
Fix #250