Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix detection of upstream version branches with continue#265

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

abadger
Copy link
Contributor

cherry_picker has recently grown support for prefixed version branches
(like stable-2.6). The --continue support had a bug with those branches
where it wouldn't account for the fact that those branches could have
extra dashes in them and thus mixing branch name with sha.

This commit should fix those situations.

cherry_picker has recently grown support for prefixed version branches(like stable-2.6).  The --continue support had a bug with those brancheswhere it wouldn't account for the fact that those branches could haveextra dashes in them and thus mixing branch name with sha.This commit should fix those situations.
@webknjaz
Copy link
Contributor

@abadger You need to take into account case when a user might run--continue from a different branch:

=================================== FAILURES ===================================______________________ test_get_base_branch_without_dash _______________________deftest_get_base_branch_without_dash():        cherry_pick_branch='master'>       result = get_base_branch(cherry_pick_branch)cherry_picker/test.py:43: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cherry_pick_branch = 'master'defget_base_branch(cherry_pick_branch):"""return'2.7'from'backport-sha-2.7'""">       prefix, sha, base_branch = cherry_pick_branch.split('-', 2)E       ValueError: not enough values to unpack (expected 3, got 1)cherry_picker/cherry_picker.py:425: ValueError===================== 1 failed, 27 passed in 0.35 seconds ======================

@abadger
Copy link
ContributorAuthor

Ah... I thought rpartition traced back in that case too but I see now it always returns a three tuple.

I can replicate the previous behaviour here but I'm not sure... is that actually sensible behaviour? From where it's being called, I think that this would cause other bugs.

@abadger
Copy link
ContributorAuthor

So the two places that get_base_branch is currently called from are:

Thinking about this more, it feels like this function is assuming that it's taking a string of a known format, assigning semantic meaning to pieces of that string based on their position inside of it, and then returning the value that corresponds to one of those meanings. If so, it feels right that the code should raise a ValueError if the string does not conform to the format... Otherwise how would we know what portion of the string was the base branch? Is it all of it? Is it the first piece? The last piece? Or perhaps none of those because we weren't given a string containing the base branch at all?

So I think the test is wrong but perhaps there's some other use case for this code that I am not aware of?@Mariatta ? Input from you?

@abadger
Copy link
ContributorAuthor

I've pushed a change to the test cases which removes the "no_dash" test and adds one for "dashes in the base branch".

@abadgerabadgerforce-pushed thefix-continue-with-prefixed-version-branches branch from04e31d5 tof90d993CompareJune 16, 2018 22:32
@webknjaz
Copy link
Contributor

I can replicate the previous behaviour here but I'm not sure... is that actually sensible behaviour? From where it's being called, I think that this would cause other bugs.

Git itself is a very stateful tool, so it's expected that when you rely on it there's some restrictions.

abadger added a commit to abadger/core-workflow that referenced this pull requestJun 16, 2018
When running cherry_picker --continue we count on being able to getcertain information from the branch's name which cherry_pickerconstructed earlier.  Verify as best we can that the branch name is onewhich cherry_picker could have constructed.Relies on the changes here:python#265(which does the work of one of the validations)
@abadger
Copy link
ContributorAuthor

My question doesn't come from what git does; it comes from what cherry-picker is doing with this branch name. AFAICT, the branch name has to be one that we created (with the three dashes), otherwise the present code will fail. So it seems like the current test that no dashes works is testing something that we'll never want the code itself to do.

@abadgerabadger reopened thisJun 19, 2018
abadger added a commit to abadger/core-workflow that referenced this pull requestJun 22, 2018
When running cherry_picker --continue we count on being able to getcertain information from the branch's name which cherry_pickerconstructed earlier.  Verify as best we can that the branch name is onewhich cherry_picker could have constructed.Relies on the changes here:python#265(which does the work of one of the validations)
@webknjaz
Copy link
Contributor

@Mariatta this PR looks ready :)

@Mariatta
Copy link
Member

Sorry for the delay in responding to this! 🙇‍♀️
The original implementation was based on CPython's branch names that doesn't include dashes, so it didn't handle ansible's situation.
Thanks for catching and fixing this!

webknjaz reacted with hooray emoji

@MariattaMariatta merged commitff8a587 intopython:masterJul 9, 2018
abadger added a commit to abadger/core-workflow that referenced this pull requestJul 9, 2018
When running cherry_picker --continue we count on being able to getcertain information from the branch's name which cherry_pickerconstructed earlier.  Verify as best we can that the branch name is onewhich cherry_picker could have constructed.Relies on the changes here:python#265(which does the work of one of the validations)
@abadgerabadger deleted the fix-continue-with-prefixed-version-branches branchJuly 18, 2018 19:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@webknjazwebknjazwebknjaz approved these changes

@MariattaMariattaMariatta approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@abadger@webknjaz@Mariatta@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp