@@ -557,60 +557,80 @@ dismissing your previous review that requested changes.
557557Note that pushing new changes after the auto-merge flow was enabled
558558does **NOT ** stop it.
559559
560+
560561Backporting merged changes
561562--------------------------
562563
563- A pull request may need to be backported into one of the maintenance branches
564- after it has been accepted and merged into `` main ``. It is usually indicated
565- by the label `` needs backport to X.Y `` on the pull request itself .
564+ After a pull request has been merged into `` main ``, it may need to be backported
565+ to one or more maintenance branches. This is indicated by the
566+ :samp: ` needs backport to { X.Y } ` labels on the pull request.
566567
567- Use the utility script
568- `cherry_picker.py <https://github.com/python/cherry-picker >`__
569- to backport the commit.
568+ ``miss-islington `` will automatically attempt to create backport PRs for the
569+ versions indicated by these labels. If ``miss-islington `` cannot create a
570+ backport PR due to conflicts, you can use the :pypi: `cherry-picker ` tool to
571+ create the backport and resolve the conflicts manually.
570572
571- The commit hash for backporting is the squashed commit that was merged to
572- the ``main `` branch. On the merged pull request, scroll to the bottom of the
573- page. Find the event that says something like:
573+ You need the commit hash of the squashed commit that was merged into
574+ the ``main `` branch. ``miss-islington `` should post a comment when it is unable
575+ to create the backport automatically, including the full command and commit hash.
576+ If that comment is not posted, look for an event on the merged
577+ pull request similar to:
574578
575579.. code-block :: text
576580
577581 <core_developer> merged commit <commit_sha1> into python:main <sometime> ago.
578582
579- By following the link to ``<commit_sha1> ``, you will get the full commit hash.
583+ By following the link to ``<commit_sha1> ``, you can get the full commit hash.
580584
581- Alternatively, the commit hash can also be obtained by the following Git
585+ Alternatively, the commit hash can also be obtained with the following Git
582586commands::
583587
584588 $ git fetch upstream
585- $ git rev-parse ":/gh-12345"
589+ $ git rev-parse ":/gh-<PR number>"
590+
591+ These commands print the hash of the commit whose message contains ``gh-<PR number> ``.
592+
593+ You can then use the commit hash and the :pypi: `cherry-picker ` tool to create
594+ the backport. In the following command, ``<branch> `` is the target maintenance
595+ branch (for example, ``3.12 ``):
596+
597+ .. code-block :: text
598+
599+ $ cherry_picker <commit_sha1> <branch>
586600
587- The above commands will print out the hash of the commit containing
588- ``"gh-12345" `` as part of the commit message.
601+ Then, follow the instructions provided. You will have to identify the files
602+ with conflicts, fix them, and build and run applicable tests if necessary.
603+ When you are finished, ``git add `` all modified files and run
604+ ``cherry_picker --continue `` to push the backport.
589605
590- When formatting the commit message for a backport commit: leave the original
591- one as is and delete the number of the backport pull request.
606+ The tool usually generates the commit message automatically. If it does not, use
607+ the following format: Keep the original commit message unchanged, except for
608+ removing the backport pull request number (``(#XXXXX) ``). At the end of the
609+ message, append a ``(cherry picked from commit <commit_sha1>) `` line.
592610
593- ✅ Example of good backport commit message:
611+ Example of good backport commit message:
594612
595613.. code-block :: text
596614 :class: good
597615
598- gh-12345: Improve the spam module (GH-777 )
616+ gh-XXXXX: <original commit title> (GH-XXXXX )
599617
600- * Add method A to the spam module
601- * Update the documentation of the spam module
618+ <original commit body>
602619
603- (cherry picked from commit 62adc55 )
620+ (cherry picked from commit <commit_sha1> )
604621
605- ❌ Example of bad backport commit message:
622+ Example of bad backport commit message:
606623
607624.. code-block :: text
608625 :class: bad
609626
610- gh-12345: Improve the spam module (GH-777) (#888)
627+ gh-XXXXX: Custom title (GH-XXXXX) (#XXXXX)
628+
629+ * Custom message
630+
631+ After the backport PR is opened, ``miss-islington `` will link it to the original
632+ PR and remove the corresponding backport label.
611633
612- * Add method A to the spam module
613- * Update the documentation of the spam module
614634
615635Editing a pull request prior to merging
616636---------------------------------------
0 commit comments