Skip to content

Add --abort/--continue, --status, auto prefix commit msg with [X.Y] #68

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

Merged
merged 8 commits into from
Apr 15, 2017

Conversation

Mariatta
Copy link
Member

@Mariatta Mariatta commented Apr 3, 2017

Lots of changes here:

Closes #44
Closes #45

--abort:
Do `git cherry-pick --abort`
Clean up branch

--continue
Do `git commit -am "resolved" --allow-empty`
Clean up branch

Closes python#45
@Mariatta Mariatta changed the title Add --abort/--continue, --status, auto prefix commit msg with [X.Y] (wip) Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Apr 9, 2017
@Mariatta
Copy link
Member Author

Mariatta commented Apr 9, 2017

Backported this PR using the latest revision: python/cpython#1053
The prefix [3.6] was added automatically by cherry_picker.py.

@Mariatta Mariatta changed the title (wip) Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Apr 9, 2017
Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

This looks like a really nice refactoring & enhancement to me, just some minor questions/comments inline.

def fetch_upstream(self):
""" git fetch <upstream> """
# self.run_cmd(f"git fetch {self.upstream}")
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still meant to be commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the catch! 😅 Re-enabled this.

click.echo(f" dry-run: Create new PR: {url}")
return
webbrowser.open_new_tab(url)
if '-' in cherry_pick_branch:
Copy link
Contributor

Choose a reason for hiding this comment

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

rpartition should allow this function to be simplified a bit: https://docs.python.org/3/library/stdtypes.html#str.rpartition

Specifically, I think it's just:

prefix, sep, base_branch = cherry_pick_branch.rpartition('-')
return base_branch

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

::

-- dry-run Dry Run Mode. Prints out the commands, but not executed.
-- push REMOTE Specify the branch to push into. Default is 'origin'.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/branch/git remote/


def test_sorted_branch():
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be handy to keep this test, either by splitting it out to a help function that's called by the property implementation, or else by testing cherry_picker.CherryPicker.sorted_branches.fget directly on a dummy object with a suitable branches attribute.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I've been working on more tests. This is back in now. :)

@Mariatta Mariatta changed the title Add --abort/--continue, --status, auto prefix commit msg with [X.Y] (wip) Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Apr 11, 2017
Re-enable fetch from upstream
more tests
update readme
@Mariatta Mariatta changed the title (wip) Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Add --abort/--continue, --status, auto prefix commit msg with [X.Y] Apr 14, 2017
@Mariatta Mariatta merged commit 8ff2bb0 into python:master Apr 15, 2017
@Mariatta Mariatta deleted the refactor branch April 15, 2017 01:11
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.

Consider how to handle failed cherry-picks Add the branch number to cherry pick commits?
3 participants