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

Add support for default branch detection #254

Merged
merged 10 commits into from
Jun 10, 2018

Conversation

webknjaz
Copy link
Contributor

Fix #250

@@ -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()
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

@Mariatta Mariatta left a 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

@webknjaz webknjaz force-pushed the feature/autodetect-branch-name branch 2 times, most recently from f09b0fd to 5a7efe8 Compare June 9, 2018 09:14
@webknjaz
Copy link
Contributor Author

webknjaz commented Jun 9, 2018

@Mariatta

Fair enough! I've changed it as suggested and added doc to readme.

Copy link
Member

@Mariatta Mariatta left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks! 🌮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants