
On 8/9/22 21:49, Simon Glass wrote:
Link to patman's documentation from the doc/ directory so that it appears in the 'make htmldocs' output.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
Fix up access to help from patman tool
doc/develop/index.rst | 1 + doc/develop/patman.rst | 1 + doc/develop/sending_patches.rst | 16 + tools/patman/README.rst | 1 + tools/patman/main.py | 3 +- tools/patman/{README => patman.rst} | 526 ++++++++++++++-------------- 6 files changed, 287 insertions(+), 261 deletions(-) create mode 120000 doc/develop/patman.rst create mode 100644 doc/develop/sending_patches.rst create mode 120000 tools/patman/README.rst rename tools/patman/{README => patman.rst} (52%)
diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 7c41e3f1b6e..7476f9ca0eb 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -14,6 +14,7 @@ General process release_cycle system_configuration
sending_patcheshis
Implementation
diff --git a/doc/develop/patman.rst b/doc/develop/patman.rst new file mode 120000 index 00000000000..0fcb7d61d40 --- /dev/null +++ b/doc/develop/patman.rst @@ -0,0 +1 @@ +../../tools/patman/patman.rst \ No newline at end of file diff --git a/doc/develop/sending_patches.rst b/doc/develop/sending_patches.rst new file mode 100644 index 00000000000..0542adeaed9 --- /dev/null +++ b/doc/develop/sending_patches.rst
Thanks for moving this to the HTML documentation.
This files contains numerous formatting errors which are not covered by your diff. It is worthwhile to look at the output of 'make htmldocs'.
May I apply the following when merging?
Do we need the incomplete changelog?
By the way, Independence Day 2020 depends on the country the reader lives in, August 15th in India.
Best regards
Heinrich
diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst index 52151f6f16..f2e6d7636f 100644 --- a/tools/patman/patman.rst +++ b/tools/patman/patman.rst @@ -1,19 +1,31 @@ .. SPDX-License-Identifier: GPL-2.0+ .. Copyright (c) 2011 The Chromium OS Authors +.. Simon Glass sjg@chromium.org +.. v1, v2, 19-Oct-11 +.. revised v3 24-Nov-11 +.. revised v4 04-Jul-2020, with Patchwork integration
Patman patch manager ====================
This tool is a Python script which: + - Creates patch directly from your branch + - Cleans them up by removing unwanted tags + - Inserts a cover letter with change lists + - Runs the patches through checkpatch.pl and its own checks + - Optionally emails them out to selected people
It also has some Patchwork features: + - shows review tags from Patchwork so you can update your local patches + - pulls these down into a new branch on request + - lists comments received on a series
It is intended to automate patch creation and make it a less @@ -41,12 +53,15 @@ This tool requires a certain way of working:
- Maintain a number of branches, one for each patch series you are working on + - Add tags into the commits within each branch to indicate where the series should be sent, cover letter, version, etc. Most of these are normally in the top commit so it is easy to change them with 'git commit --amend' + - Each branch tracks the upstream branch, so that this script can automatically determine the number of commits in it (optional) + - Check out a branch, and run this script to create and send out your patches. Weeks later, change the patches and repeat, knowing that you will get a consistent result each time. @@ -117,21 +132,25 @@ project you can add a section that looks like [project_settings] or How to run it -------------
-First do a dry run:: +First do a dry run:
- $ ./tools/patman/patman send -n +.. code-block:: bash + + ./tools/patman/patman send -n
If it can't detect the upstream branch, try telling it how many patches -there are in your series:: +there are in your series + +.. code-block:: bash
- $ ./tools/patman/patman -c5 send -n + ./tools/patman/patman -c5 send -n
This will create patch files in your current directory and tell you who -it is thinking of sending them to. Take a look at the patch files +it is thinking of sending them to. Take a look at the patch files:
-:: +.. code-block:: bash
- $ ./tools/patman/patman -c5 -s1 send -n + ./tools/patman/patman -c5 -s1 send -n
Similar to the above, but skip the first commit and take the next 5. This is useful if your top commit is for setting up testing. @@ -143,9 +162,11 @@ How to install it The most up to date version of patman can be found in the U-Boot sources. However to use it on other projects it may be more convenient to install it as a standalone application. A distutils installer is included, this can be used -to install patman:: +to install patman:
- $ cd tools/patman && python setup.py install +.. code-block:: bash + + cd tools/patman && python setup.py install
How to add tags @@ -191,6 +212,8 @@ Series-links: [id | version:id]... the series ID is 187331. This property can have a list of series IDs, one for each version of the series, e.g.
+ :: + Series-links: 1:187331 2:188434 189372
Patman always uses the one without a version, since it assumes this is @@ -222,7 +245,7 @@ Series-notes: Sets some notes for the patch series, which you don't want in the commit messages, but do want to send, The notes are joined together and put after the cover letter. Can appear multiple - times: + times::
Series-notes: blah blah @@ -252,7 +275,7 @@ Tested-by / Reviewed-by / Acked-by you send out the next version. If 'Tested-by:' is set to yourself, it will be removed. No one will believe you.
- Example::: + Example::
Tested-by: Their Name fred@bloggs.com Reviewed-by: Their Name <email> @@ -313,6 +336,7 @@ Series-process-log: sort, uniq with a whitespace character. For example,
Example:: + - This change continues onto the next line - But this change is separate @@ -354,12 +378,12 @@ this:: Author: Mike Frysinger vapier@gentoo.org Date: Mon Nov 7 23:18:44 2011 -0500
- x86: arm: add a git mailrc file for maintainers + x86: arm: add a git mailrc file for maintainers
- This should make sending out e-mails to the right people easier. + This should make sending out e-mails to the right people easier.
- Patch-cc: sandbox, mikef, ag - Patch-cc: afleming + Patch-cc: sandbox, mikef, ag + Patch-cc: afleming
will create a patch which is copied to x86, arm, sandbox, mikef, ag and afleming. @@ -384,7 +408,9 @@ you sent your series. To set this up, add a Series-link tag to one of the commits in your series (see above).
-Then you can type:: +Then you can type: + +.. code-block:: bash
patman status
@@ -405,14 +431,18 @@ attracted another review each. If the series needs changes, you can update these commits with the new review tag before sending the next version of the series.
-To automatically pull into these tags into a new branch, use the -d option:: +To automatically pull into these tags into a new branch, use the -d option: + +.. code-block:: bash
patman status -d mtrr4
This will create a new 'mtrr4' branch which is the same as your current branch but has the new review tags in it. The tags are added in alphabetic order and are placed immediately after any existing ack/review/test/fixes tags, or at the -end. You can check that this worked with:: +end. You can check that this worked with: + +.. code-block:: bash
patman -b mtrr4 status
@@ -441,29 +471,39 @@ output by git log --oneline):: The first patch is some test things that enable your code to be compiled, but that you don't want to submit because there is an existing patch for it on the list. So you can tell patman to create and check some patches -(skipping the first patch) with:: +(skipping the first patch) with: + +.. code-block:: bash
patman -s1 send -n
If you want to do all of them including the work-in-progress one, then -(if you are tracking an upstream branch):: +(if you are tracking an upstream branch): + +.. code-block:: bash
patman send -n
-Let's say that patman reports an error in the second patch. Then:: +Let's say that patman reports an error in the second patch. Then: + +.. code-block:: bash
git rebase -i HEAD~6 - <change 'pick' to 'edit' in 89234f5> - <use editor to make code changes> + # change 'pick' to 'edit' in 89234f5 + # use editor to make code changes git add -u git rebase --continue
-Now you have an updated patch series. To check it:: +Now you have an updated patch series. To check it: + +.. code-block:: bash
patman -s1 send -n
Let's say it is now clean and you want to send it. Now you need to set up -the destination. So amend the top commit with:: +the destination. So amend the top commit with: + +.. code-block:: bash
git commit --amend
@@ -493,7 +533,9 @@ to Marek. Two of the patches have tags (those are the bits at the front of the subject that say mmc: sparc: and sandbox:), so 8d640a7 will be Cc'd to mmc and sparc, and the last one to sandbox.
-Now to send the patches, take off the -n flag:: +Now to send the patches, take off the -n flag: + +.. code-block:: bash
patman -s1 send
@@ -508,23 +550,29 @@ so you can drop your wip commit.
Take a look on patchwork and find out the URL of the series. This will be something like `http://patchwork.ozlabs.org/project/uboot/list/?series=187331%60 -Add this to a tag in your top commit: +Add this to a tag in your top commit::
Series-links: 187331
You can use then patman to collect the Acked-by tag to the correct commit, -creating a new 'version 2' branch for us-cmd:: +creating a new 'version 2' branch for us-cmd: + +.. code-block:: bash
patman status -d us-cmd2 git checkout us-cmd2
-You can look at the comments in Patchwork or with:: +You can look at the comments in Patchwork or with: + +.. code-block:: bash
patman status -C
-Then you can resync with upstream:: +Then you can resync with upstream:
- git fetch origin (or whatever upstream is called) +.. code-block:: bash + + git fetch origin # or whatever upstream is called git rebase origin/master
and use git rebase -i to edit the commits, dropping the wip one. @@ -563,7 +611,9 @@ you have a new series of commits:: cfbe330 Rename run_command2() to run_command() 0682677 sandbox: Rename run_command() to builtin_run_command()
-so to send them:: +so to send them: + +.. code-block:: bash
patman
@@ -583,10 +633,12 @@ General points
3. If you want to keep the commits from each series you sent so that you can compare change and see what you did, you can either create a new branch for - each version, or just tag the branch before you start changing it:: + each version, or just tag the branch before you start changing it: + +.. code-block:: bash
git tag sent/us-cmd-rfc - ...later... + # ...later... git tag sent/us-cmd-v2
4. If you want to modify the patches a little before sending, you can do @@ -637,7 +689,9 @@ Most of these are indicated by a TODO in the code. It would be nice if this could handle the In-reply-to side of things.
The tests are incomplete, as is customary. Use the 'test' subcommand to run -them:: +them: + +.. code-block:: bash
$ tools/patman/patman test
@@ -647,9 +701,3 @@ putting an incorrect tag in a commit may provide a confusing message. There might be a few other features not mentioned in this README. They might be bugs. In particular, tags are case sensitive which is probably a bad thing. - - -Simon Glass sjg@chromium.org -v1, v2, 19-Oct-11 -revised v3 24-Nov-11 -revised v4 Independence Day 2020, with Patchwork integration