Skip to content

Clarify that backports should start from the squashed-and-merged commit #238

Closed

Description

@ncoghlan

After pointing a new contributor to https://docs.python.org/devguide/gitbootcamp.html#backporting-merged-changes to handle their own backport PRs, I discovered that it's currently taking a step for granted: finding the relevant commit to backport from the CPython master branch, rather than squashing your original PR branch locally.

Since we specifically want to use the squashed-and-merged commit so that the backports include the corresponding commit message, we should make that explicit here.

Activity

  1. ncoghlan commented on Jul 21, 2017

    @ncoghlan
    ContributorAuthor

    Some initial thoughts on how we might improve this:

    1. Move https://docs.python.org/devguide/gitbootcamp.html#backporting-merged-changes to be directly after https://docs.python.org/devguide/gitbootcamp.html#accepting-and-merging-a-pull-request

    2. Add a note suggesting the following pair of commands:

      git fetch upstream
      git rev-parse ":/bpo-12345"
      
    3. Mention that the relevant commit hash can also be found by looking at the merge notification on the original PR (e.g. bpo-30964: Mention ensurepip in package installation docs cpython#2786 (comment) )

  2. Mariatta commented on Jul 21, 2017

    @Mariatta
    Member

    There's a write up about which commit hash to use in cherry_picker
    It can be copied over here.

  3. terryjreedy commented on Jul 21, 2017

    @terryjreedy
    Member

    I presume 'bpo-1235' is a stand-in for the fork branch the PR is based on. Once the merge is done, it disappears from the PR (as the PR can no longer be added to using the branch name ;-). Copying the commit hash available after the PR is merged seems best. I try to remember to grab it before I start typing the cherry_picker command. (Which is working quite well for simple backports.)

  4. ncoghlan commented on Jul 21, 2017

    @ncoghlan
    ContributorAuthor

    @terryjreedy git rev-parse ":/bpo-12345" searches for a commit message containing the given string (rather than a branch name) and returns the commit hash(es). But getting the commit hash from the PR page also works just as well.

    (That said, "How do I find all commits mentioning a particular issue?" could be a useful cheatsheet entry in its own right)

  5. NicholasKobald commented on Jul 21, 2017

    @NicholasKobald

    I think indicating explicitly in that section which commit should be used would be helpful. The snippet you posted just now is what got me to the root of the problem/fix quickly. I think both the snippet referred to by Mariatta and your snippet could be useful on that page/section.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions