Merge tag 'u-boot-atmel-fixes-2021.01-b' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / tools / patman / README
index b3aba13..6b80663 100644 (file)
@@ -1,7 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
 # Copyright (c) 2011 The Chromium OS Authors.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
 
 What is this?
 =============
@@ -13,9 +11,14 @@ This tool is a Python script which:
 - 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
 error-prone process. It is useful for U-Boot and Linux work so far,
-since it uses the checkpatch.pl script.
+since they use the checkpatch.pl script.
 
 It is configured almost entirely by tags it finds in your commits.
 This means that you can work on a number of different branches at
@@ -27,8 +30,8 @@ Series-to: fred.blogs@napier.co.nz
 
 in one of your commits, the series will be sent there.
 
-In Linux this will also call get_maintainer.pl on each of your
-patches automatically.
+In Linux and U-Boot this will also call get_maintainer.pl on each of your
+patches automatically (unless you use -m to disable this).
 
 
 How to use this tool
@@ -52,12 +55,15 @@ will get a consistent result each time.
 How to configure it
 ===================
 
-For most cases of using patman for U-Boot development, patman will
-locate and use the file 'doc/git-mailrc' in your U-Boot directory.
-This contains most of the aliases you will need.
+For most cases of using patman for U-Boot development, patman can use the
+file 'doc/git-mailrc' in your U-Boot directory to supply the email aliases
+you need. To make this work, tell git where to find the file by typing
+this once:
+
+    git config sendemail.aliasesfile doc/git-mailrc
 
-For Linux the 'scripts/get_maintainer.pl' handles figuring out where
-to send patches pretty well.
+For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
+out where to send patches pretty well.
 
 During the first run patman creates a config file for you by taking the default
 user name and email address from the global .gitconfig file.
@@ -81,6 +87,18 @@ Aliases are recursive.
 The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
 used. Failing that you can put it into your path or ~/bin/checkpatch.pl
 
+If you want to avoid sending patches to email addresses that are picked up
+by patman but are known to bounce you can add a [bounces] section to your
+.patman file. Unlike the [alias] section these are simple key: value pairs
+that are not recursive.
+
+>>>
+
+[bounces]
+gonefishing: Fred Bloggs <f.bloggs@napier.net>
+
+<<<
+
 
 If you want to change the defaults for patman's command-line arguments,
 you can add a [settings] section to your .patman file.  This can be used
@@ -94,6 +112,8 @@ patman.py.  For reference, the useful ones (at the moment) shown below
 ignore_errors: True
 process_tags: False
 verbose: True
+smtp_server: /path/to/sendmail
+patchwork_server: https://patchwork.ozlabs.org
 
 <<<
 
@@ -132,6 +152,17 @@ 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.
 
 
+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:
+
+$ cd tools/patman && python setup.py install
+
+
 How to add tags
 ===============
 
@@ -151,13 +182,38 @@ Series-version: n
 
 Series-prefix: prefix
        Sets the subject prefix. Normally empty but it can be RFC for
-       RFC patches, or RESEND if you are being ignored.
+       RFC patches, or RESEND if you are being ignored. The patch subject
+       is like [RFC PATCH] or [RESEND PATCH].
+       In the meantime, git format.subjectprefix option will be added as
+       well. If your format.subjectprefix is set to InternalProject, then
+       the patch shows like: [InternalProject][RFC/RESEND PATCH]
 
 Series-name: name
        Sets the name of the series. You don't need to have a name, and
        patman does not yet use it, but it is convenient to put the branch
        name here to help you keep track of multiple upstreaming efforts.
 
+Series-links: [id | version:id]...
+       Set the ID of the series in patchwork. You can set this after you send
+       out the series and look in patchwork for the resulting series. The
+       URL you want is the one for the series itself, not any particular patch.
+       E.g. for http://patchwork.ozlabs.org/project/uboot/list/?series=187331
+       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
+       the latest one. When this tag is provided, patman can compare your local
+       branch against patchwork to see what new reviews your series has
+       collected ('patman status').
+
+Series-patchwork-url: url
+       This allows specifying the Patchwork URL for a branch. This overrides
+       both the setting files and the command-line argument. The URL should
+       include the protocol and web site, with no trailing slash, for example
+       'https://patchwork.ozlabs.org/project'
+
 Cover-letter:
 This is the patch set title
 blah blah
@@ -192,6 +248,7 @@ END
        A sign-off is added automatically to your patches (this is
        probably a bug). If you put this tag in your patches, it will
        override the default signoff that patman automatically adds.
+       Multiple duplicate signoffs will be removed.
 
  Tested-by: Their Name <email>
  Reviewed-by: Their Name <email>
@@ -217,24 +274,53 @@ Series-changes: n
        to update the log there and then, knowing that the script will
        do the rest.
 
+Commit-changes: n
+- This line will not appear in the cover-letter changelog
+<blank line>
+       This tag is like Series-changes, except changes in this changelog will
+       only appear in the changelog of the commit this tag is in. This is
+       useful when you want to add notes which may not make sense in the cover
+       letter. For example, you can have short changes such as "New" or
+       "Lint".
+
+Cover-changes: n
+- This line will only appear in the cover letter
+<blank line>
+       This tag is like Series-changes, except changes in this changelog will
+       only appear in the cover-letter changelog. This is useful to summarize
+       changes made with Commit-changes, or to add additional context to
+       changes.
+
 Patch-cc: Their Name <email>
        This copies a single patch to another email address. Note that the
        Cc: used by git send-email is ignored by patman, but will be
        interpreted by git send-email if you use it.
 
 Series-process-log: sort, uniq
-       This tells patman to sort and/or uniq the change logs. It is
-       assumed that each change log entry is only a single line long.
+       This tells patman to sort and/or uniq the change logs. Changes may be
+       multiple lines long, as long as each subsequent line of a change begins
+       with a whitespace character. For example,
+
+- This change
+  continues onto the next line
+- But this change is separate
+
        Use 'sort' to sort the entries, and 'uniq' to include only
        unique entries. If omitted, no change log processing is done.
        Separate each tag with a comma.
 
+Change-Id:
+       This tag is stripped out but is used to generate the Message-Id
+       of the emails that will be sent. When you keep the Change-Id the
+       same you are asserting that this is a slightly different version
+       (but logically the same patch) as other patches that have been
+       sent out with the same Change-Id.
+
 Various other tags are silently removed, like these Chrome OS and
 Gerrit tags:
 
 BUG=...
 TEST=...
-Change-Id:
 Review URL:
 Reviewed-on:
 Commit-xxxx: (except Commit-notes)
@@ -278,6 +364,53 @@ These people will get the cover letter even if they are not on the To/Cc
 list for any of the patches.
 
 
+Patchwork Integration
+=====================
+
+Patman has a very basic integration with Patchwork. If you point patman to
+your series on patchwork it can show you what new reviews have appears since
+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
+
+    patman status
+
+and patman will show you each patch and what review tags have been collected,
+for example:
+
+...
+ 21 x86: mtrr: Update the command to use the new mtrr
+    Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
+  + Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
+ 22 x86: mtrr: Restructure so command execution is in
+    Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
+  + Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
+...
+
+This shows that patch 21 and 22 were sent out with one review but have since
+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:
+
+    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:
+
+    patman -b mtrr4 status
+
+which should show that there are no new responses compared to this new branch.
+
+There is also a -C option to list the comments received for each patch.
+
+
 Example Work Flow
 =================
 
@@ -361,17 +494,33 @@ people on the list don't see your secret info.
 Of course patches often attract comments and you need to make some updates.
 Let's say one person sent comments and you get an Acked-by: on one patch.
 Also, the patch on the list that you were waiting for has been merged,
-so you can drop your wip commit. So you resync with upstream:
+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
+Add this to a tag in your top commit:
+
+   Series-link: http://patchwork.ozlabs.org/project/uboot/list/?series=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:
+
+    patman status -d us-cmd2
+    git checkout us-cmd2
+
+You can look at the comments in Patchwork or with:
+
+    patman status -C
+
+Then you can resync with upstream:
 
     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. You add
-the ack tag to one commit:
-
-    Acked-by: Heiko Schocher <hs@denx.de>
+and use git rebase -i to edit the commits, dropping the wip one.
 
-update the Series-cc: in the top commit:
+Then update the Series-cc: in the top commit to add the person who reviewed
+the v1 series:
 
     Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
 
@@ -410,7 +559,9 @@ so to send them:
 
 and it will create and send the version 2 series.
 
-General points:
+
+General points
+==============
 
 1. When you change back to the us-cmd branch days or weeks later all your
 information is still there, safely stored in the commits. You don't need
@@ -438,6 +589,33 @@ print out the command line patman would have used.
 not later when you can't remember which patch you changed. You can always
 go back and change or remove logs from commits.
 
+7. Some mailing lists have size limits and when we add binary contents to
+our patches it's easy to exceed the size limits. Use "--no-binary" to
+generate patches without any binary contents. You are supposed to include
+a link to a git repository in your "Commit-notes", "Series-notes" or
+"Cover-letter" for maintainers to fetch the original commit.
+
+8. Patches will have no changelog entries for revisions where they did not
+change. For clarity, if there are no changes for this patch in the most
+recent revision of the series, a note will be added. For example, a patch
+with the following tags in the commit
+
+    Series-version: 5
+    Series-changes: 2
+    - Some change
+
+    Series-changes: 4
+    - Another change
+
+would have a changelog of
+
+    (no changes since v4)
+
+    Changes in v4:
+    - Another change
+
+    Changes in v2:
+    - Some change
 
 Other thoughts
 ==============
@@ -447,12 +625,10 @@ 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 flag to run them,
-and make sure you are in the tools/patman directory first:
+The tests are incomplete, as is customary. Use the 'test' subcommand to run
+them:
 
-    $ cd /path/to/u-boot
-    $ cd tools/patman
-    $ ./patman --test
+    $ tools/patman/patman test
 
 Error handling doesn't always produce friendly error messages - e.g.
 putting an incorrect tag in a commit may provide a confusing message.
@@ -465,3 +641,4 @@ 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