Skip to content

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

Merged
Mariatta merged 8 commits into
python:masterfrom
Mariatta:refactor
Apr 15, 2017
Merged

Add --abort/--continue, --status, auto prefix commit msg with [X.Y]#68
Mariatta merged 8 commits into
python:masterfrom
Mariatta:refactor

Conversation

@Mariatta

@Mariatta Mariatta commented Apr 3, 2017

Copy link
Copy Markdown
Member

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

Mariatta commented Apr 9, 2017

Copy link
Copy Markdown
Member Author

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

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread cherry_picker/cherry_picker.py Outdated
def fetch_upstream(self):
""" git fetch <upstream> """
# self.run_cmd(f"git fetch {self.upstream}")
pass

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread cherry_picker/cherry_picker.py Outdated
click.echo(f" dry-run: Create new PR: {url}")
return
webbrowser.open_new_tab(url)
if '-' in cherry_pick_branch:

Copy link
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done :)

Comment thread cherry_picker/readme.rst Outdated
::

-- 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
Copy Markdown
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/

Comment thread cherry_picker/test.py
subprocess_check_output.return_value = b'master'
assert get_current_branch() == 'master'

def test_sorted_branch():

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