• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..19-Aug-2025-

test/19-Aug-2025-

.checkpatch.conf A D19-Aug-2025814

.gitignore A D19-Aug-20256 21

README.rst A D19-Aug-202533 KiB1,024715

__init__.py A D19-Aug-2025348 96

__main__.py A D19-Aug-20251.6 KiB6034

checkpatch.py A D19-Aug-20259.6 KiB288238

cmdline.py A D19-Aug-202518.3 KiB517415

commit.py A D19-Aug-20253.6 KiB11591

control.py A D19-Aug-202512.7 KiB334291

cser_helper.py A D19-Aug-202554.6 KiB1,5251,266

cseries.py A D19-Aug-202543.9 KiB1,166934

database.py A D19-Aug-202526.3 KiB824635

func_test.py A D19-Aug-202549 KiB1,3431,066

get_maintainer.py A D19-Aug-20252 KiB6544

patchstream.py A D19-Aug-202533.7 KiB923702

patchwork.py A D19-Aug-202534.9 KiB853704

patman A D19-Aug-20251.6 KiB6034

patman.rst A D19-Aug-202533 KiB1,024715

project.py A D19-Aug-2025726 2817

pyproject.toml A D19-Aug-2025794 3025

pytest.ini A D19-Aug-202537 32

requirements.txt A D19-Aug-2025115 76

send.py A D19-Aug-20258 KiB198154

series.py A D19-Aug-202518 KiB488413

settings.py A D19-Aug-202513.6 KiB445346

setup.py A D19-Aug-2025340 129

status.py A D19-Aug-202515.3 KiB406338

test_checkpatch.py A D19-Aug-202517.5 KiB533439

test_common.py A D19-Aug-20258.5 KiB255207

test_cseries.py A D19-Aug-2025143.2 KiB3,6852,946

test_settings.py A D19-Aug-20252.3 KiB6848

README.rst

1.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright (c) 2011 The Chromium OS Authors
3.. Simon Glass <sjg@chromium.org>
4.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
5.. v1, v2, 19-Oct-11
6.. revised v3 24-Nov-11
7.. revised v4 Independence Day 2020, with Patchwork integration
8
9Patman patch manager
10====================
11
12This tool is a Python script which:
13
14- Creates patch directly from your branch
15- Cleans them up by removing unwanted tags
16- Inserts a cover letter with change lists
17- Runs the patches through checkpatch.pl and its own checks
18- Optionally emails them out to selected people
19- Links the series automatically to Patchwork once sent
20
21It also has some Patchwork features:
22
23- Manage local series and their status on patchwork
24- Show review tags from Patchwork and allows them to be gathered into commits
25- List comments received on a series
26
27It is intended to automate patch creation and make it a less
28error-prone process. It is useful for U-Boot and Linux work so far,
29since they use the checkpatch.pl script.
30
31It is configured almost entirely by tags it finds in your commits.
32This means that you can work on a number of different branches at
33once, and keep the settings with each branch rather than having to
34git format-patch, git send-email, etc. with the correct parameters
35each time. So for example if you put::
36
37    Series-to: fred.blogs@napier.co.nz
38
39in one of your commits, the series will be sent there.
40
41In Linux and U-Boot this will also call get_maintainer.pl on each of your
42patches automatically (unless you use -m to disable this).
43
44
45Installation
46------------
47
48You can install patman using::
49
50   pip install patch-manager
51
52The name is chosen since patman conflicts with an existing package.
53
54If you are using patman within the U-Boot tree, it may be easiest to add a
55symlink from your local `~/.bin` directory to `/path/to/tools/patman/patman`.
56
57How to use this tool
58--------------------
59
60This tool requires a certain way of working:
61
62- Maintain a number of branches, one for each patch series you are
63  working on
64- Add tags into the commits within each branch to indicate where the
65  series should be sent, cover letter, version, etc. Most of these are
66  normally in the top commit so it is easy to change them with 'git
67  commit --amend'
68- Each branch tracks the upstream branch, so that this script can
69  automatically determine the number of commits in it (optional)
70- Check out a branch, and run this script to create and send out your
71  patches. Weeks later, change the patches and repeat, knowing that you
72  will get a consistent result each time.
73
74
75How to configure it
76-------------------
77
78For most cases of using patman for U-Boot development, patman can use the
79file 'doc/git-mailrc' in your U-Boot directory to supply the email aliases
80you need. To make this work, tell git where to find the file by typing
81this once::
82
83    git config sendemail.aliasesfile doc/git-mailrc
84
85For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles
86figuring out where to send patches pretty well. For other projects,
87you may want to specify a different script to be run, for example via
88a project-specific `.patman` file::
89
90    # .patman configuration file at the root of some project
91
92    [settings]
93    get_maintainer_script: etc/teams.scm get-maintainer
94
95The `get_maintainer_script` option corresponds to the
96`--get-maintainer-script` argument of the `send` command.  It is
97looked relatively to the root of the current git repository, as well
98as on PATH.  It can also be provided arguments, as shown above.  The
99contract is that the script should accept a patch file name and return
100a list of email addresses, one per line, like `get_maintainer.pl`
101does.
102
103During the first run patman creates a config file for you by taking the default
104user name and email address from the global .gitconfig file.
105
106To add your own, create a file `~/.patman` like this::
107
108    # patman alias file
109
110    [alias]
111    me: Simon Glass <sjg@chromium.org>
112
113    u-boot: U-Boot Mailing List <u-boot@lists.denx.de>
114    wolfgang: Wolfgang Denk <wd@denx.de>
115    others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
116
117As hinted above, Patman will also look for a `.patman` configuration
118file at the root of the current project git repository, which makes it
119possible to override the `project` settings variable or anything else
120in a project-specific way. The values of this "local" configuration
121file take precedence over those of the "global" one.
122
123Aliases are recursive.
124
125The checkpatch.pl in the U-Boot tools/ subdirectory will be located and
126used. Failing that you can put it into your path or ~/bin/checkpatch.pl
127
128If you want to avoid sending patches to email addresses that are picked up
129by patman but are known to bounce you can add a [bounces] section to your
130.patman file. Unlike the [alias] section these are simple key: value pairs
131that are not recursive::
132
133    [bounces]
134    gonefishing: Fred Bloggs <f.bloggs@napier.net>
135
136
137If you want to change the defaults for patman's command-line arguments,
138you can add a [settings] section to your .patman file.  This can be used
139for any command line option by referring to the "dest" for the option in
140patman.py.  For reference, the useful ones (at the moment) shown below
141(all with the non-default setting)::
142
143    [settings]
144    ignore_errors: True
145    process_tags: False
146    verbose: True
147    smtp_server: /path/to/sendmail
148    patchwork_url: https://patchwork.ozlabs.org
149
150If you want to adjust settings (or aliases) that affect just a single
151project you can add a section that looks like [project_settings] or
152[project_alias].  If you want to use tags for your linux work, you could do::
153
154    [linux_settings]
155    process_tags: True
156
157
158How to run it
159-------------
160
161First do a dry run:
162
163.. code-block:: bash
164
165    ./tools/patman/patman send -n
166
167If it can't detect the upstream branch, try telling it how many patches
168there are in your series
169
170.. code-block:: bash
171
172    ./tools/patman/patman -c5 send -n
173
174This will create patch files in your current directory and tell you who
175it is thinking of sending them to. Take a look at the patch files:
176
177.. code-block:: bash
178
179    ./tools/patman/patman -c5 -s1 send -n
180
181Similar to the above, but skip the first commit and take the next 5. This
182is useful if your top commit is for setting up testing.
183
184
185How to install it
186-----------------
187
188The most up to date version of patman can be found in the U-Boot sources.
189However to use it on other projects it may be more convenient to install it as
190a standalone application. A distutils installer is included, this can be used
191to install patman:
192
193.. code-block:: bash
194
195    cd tools/patman && python setup.py install
196
197
198How to add tags
199---------------
200
201To make this script useful you must add tags like the following into any
202commit. Most can only appear once in the whole series.
203
204Series-to: email / alias
205    Email address / alias to send patch series to (you can add this
206    multiple times)
207
208Series-cc: email / alias, ...
209    Email address / alias to Cc patch series to (you can add this
210    multiple times)
211
212Series-version: n
213    Sets the version number of this patch series
214
215Series-prefix: prefix
216    Sets the subject prefix. Normally empty but it can be RFC for
217    RFC patches, or RESEND if you are being ignored. The patch subject
218    is like [RFC PATCH] or [RESEND PATCH].
219    In the meantime, git format.subjectprefix option will be added as
220    well. If your format.subjectprefix is set to InternalProject, then
221    the patch shows like: [InternalProject][RFC/RESEND PATCH]
222
223Series-postfix: postfix
224    Sets the subject "postfix". Normally empty, but can be the name of a
225    tree such as net or net-next if that needs to be specified. The patch
226    subject is like [PATCH net] or [PATCH net-next].
227
228Series-name: name
229    Sets the name of the series. You don't need to have a name, and
230    patman does not yet use it, but it is convenient to put the branch
231    name here to help you keep track of multiple upstreaming efforts.
232
233Series-links: [id | version:id]...
234    Set the ID of the series in patchwork. You can set this after you send
235    out the series and look in patchwork for the resulting series. The
236    URL you want is the one for the series itself, not any particular patch.
237    E.g. for http://patchwork.ozlabs.org/project/uboot/list/?series=187331
238    the series ID is 187331. This property can have a list of series IDs,
239    one for each version of the series, e.g.
240
241    ::
242
243       Series-links: 1:187331 2:188434 189372
244
245    Patman always uses the one without a version, since it assumes this is
246    the latest one. When this tag is provided, patman can compare your local
247    branch against patchwork to see what new reviews your series has
248    collected ('patman status').
249
250Series-patchwork-url: url
251    This allows specifying the Patchwork URL for a branch. This overrides
252    both the setting files ("patchwork_url") and the command-line argument.
253    The URL should include the protocol and web site, with no trailing slash,
254    for example 'https://patchwork.ozlabs.org/project'
255
256Cover-letter:
257    Sets the cover letter contents for the series. The first line
258    will become the subject of the cover letter::
259
260        Cover-letter:
261        This is the patch set title
262        blah blah
263        more blah blah
264        END
265
266Cover-letter-cc: email / alias
267    Additional email addresses / aliases to send cover letter to (you
268    can add this multiple times)
269
270Series-notes:
271    Sets some notes for the patch series, which you don't want in
272    the commit messages, but do want to send, The notes are joined
273    together and put after the cover letter. Can appear multiple
274    times::
275
276        Series-notes:
277        blah blah
278        blah blah
279        more blah blah
280        END
281
282Commit-notes:
283    Similar, but for a single commit (patch). These notes will appear
284    immediately below the ``---`` cut in the patch file::
285
286        Commit-notes:
287        blah blah
288        blah blah
289        more blah blah
290
291Signed-off-by: Their Name <email>
292    A sign-off is added automatically to your patches (this is
293    probably a bug). If you put this tag in your patches, it will
294    override the default signoff that patman automatically adds.
295    Multiple duplicate signoffs will be removed.
296
297Tested-by / Reviewed-by / Acked-by
298    These indicate that someone has tested/reviewed/acked your patch.
299    When you get this reply on the mailing list, you can add this
300    tag to the relevant commit and the script will include it when
301    you send out the next version. If 'Tested-by:' is set to
302    yourself, it will be removed. No one will believe you.
303
304    Example::
305
306        Tested-by: Their Name <fred@bloggs.com>
307        Reviewed-by: Their Name <email>
308        Acked-by: Their Name <email>
309
310Series-changes: n
311    This can appear in any commit. It lists the changes for a
312    particular version n of that commit. The change list is
313    created based on this information. Each commit gets its own
314    change list and also the whole thing is repeated in the cover
315    letter (where duplicate change lines are merged).
316
317    By adding your change lists into your commits it is easier to
318    keep track of what happened. When you amend a commit, remember
319    to update the log there and then, knowing that the script will
320    do the rest.
321
322    Example::
323
324        Series-changes: n
325        - Guinea pig moved into its cage
326        - Other changes ending with a blank line
327        <blank line>
328
329Commit-changes: n
330    This tag is like Series-changes, except changes in this changelog will
331    only appear in the changelog of the commit this tag is in. This is
332    useful when you want to add notes which may not make sense in the cover
333    letter. For example, you can have short changes such as "New" or
334    "Lint".
335
336    Example::
337
338        Commit-changes: n
339        - This line will not appear in the cover-letter changelog
340        <blank line>
341
342Cover-changes: n
343    This tag is like Series-changes, except changes in this changelog will
344    only appear in the cover-letter changelog. This is useful to summarize
345    changes made with Commit-changes, or to add additional context to
346    changes.
347
348    Example::
349
350        Cover-changes: n
351        - This line will only appear in the cover letter
352        <blank line>
353
354Commit-added-in: n
355    Add a change noting the version this commit was added in. This is
356    equivalent to::
357
358        Commit-changes: n
359        - New
360
361        Cover-changes: n
362        - <commit subject>
363
364    It is a convenient shorthand for suppressing the '(no changes in vN)'
365    message.
366
367Patch-cc / Commit-cc: Their Name <email>
368    This copies a single patch to another email address. Note that the
369    Cc: used by git send-email is ignored by patman, but will be
370    interpreted by git send-email if you use it.
371
372Series-process-log: sort, uniq
373    This tells patman to sort and/or uniq the change logs. Changes may be
374    multiple lines long, as long as each subsequent line of a change begins
375    with a whitespace character. For example,
376
377    Example::
378
379        - This change
380          continues onto the next line
381        - But this change is separate
382
383    Use 'sort' to sort the entries, and 'uniq' to include only
384    unique entries. If omitted, no change log processing is done.
385    Separate each tag with a comma.
386
387Change-Id:
388    This tag is used to generate the Message-Id of the emails that
389    will be sent. When you keep the Change-Id the same you are
390    asserting that this is a slightly different version (but logically
391    the same patch) as other patches that have been sent out with the
392    same Change-Id. The Change-Id tag line is removed from outgoing
393    patches, unless the `keep_change_id` settings is set to `True`.
394
395Various other tags are silently removed, like these Chrome OS and
396Gerrit tags::
397
398    BUG=...
399    TEST=...
400    Review URL:
401    Reviewed-on:
402    Commit-xxxx: (except Commit-notes)
403
404Exercise for the reader: Try adding some tags to one of your current
405patch series and see how the patches turn out.
406
407
408Where Patches Are Sent
409----------------------
410
411Once the patches are created, patman sends them using git send-email. The
412whole series is sent to the recipients in Series-to: and Series-cc.
413You can Cc individual patches to other people with the Patch-cc: tag. Tags
414in the subject are also picked up to Cc patches. For example, a commit like
415this::
416
417    commit 10212537b85ff9b6e09c82045127522c0f0db981
418    Author: Mike Frysinger <vapier@gentoo.org>
419    Date:    Mon Nov 7 23:18:44 2011 -0500
420
421    x86: arm: add a git mailrc file for maintainers
422
423    This should make sending out e-mails to the right people easier.
424
425    Patch-cc: sandbox, mikef, ag
426    Patch-cc: afleming
427
428will create a patch which is copied to x86, arm, sandbox, mikef, ag and
429afleming.
430
431If you have a cover letter it will get sent to the union of the Patch-cc
432lists of all of the other patches. If you want to sent it to additional
433people you can add a tag::
434
435    Cover-letter-cc: <list of addresses>
436
437These people will get the cover letter even if they are not on the To/Cc
438list for any of the patches.
439
440
441Patchwork Integration
442---------------------
443
444Patman has a very basic integration with Patchwork. If you point patman to
445your series on patchwork it can show you what new reviews have appeared since
446you sent your series.
447
448To set this up, add a Series-link tag to one of the commits in your series
449(see above).
450
451Then you can type:
452
453.. code-block:: bash
454
455    patman status
456
457and patman will show you each patch and what review tags have been collected,
458for example::
459
460    ...
461     21 x86: mtrr: Update the command to use the new mtrr
462        Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
463      + Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
464     22 x86: mtrr: Restructure so command execution is in
465        Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
466      + Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
467    ...
468
469This shows that patch 21 and 22 were sent out with one review but have since
470attracted another review each. If the series needs changes, you can update
471these commits with the new review tag before sending the next version of the
472series.
473
474To automatically pull into these tags into a new branch, use the -d option:
475
476.. code-block:: bash
477
478    patman status -d mtrr4
479
480This will create a new 'mtrr4' branch which is the same as your current branch
481but has the new review tags in it. The tags are added in alphabetic order and
482are placed immediately after any existing ack/review/test/fixes tags, or at the
483end. You can check that this worked with:
484
485.. code-block:: bash
486
487    patman -b mtrr4 status
488
489which should show that there are no new responses compared to this new branch.
490
491There is also a -C option to list the comments received for each patch.
492
493
494Example Work Flow
495-----------------
496
497The basic workflow is to create your commits, add some tags to the top
498commit, and type 'patman' to check and send them.
499
500Here is an example workflow for a series of 4 patches. Let's say you have
501these rather contrived patches in the following order in branch us-cmd in
502your tree where 'us' means your upstreaming activity (newest to oldest as
503output by git log --oneline)::
504
505    7c7909c wip
506    89234f5 Don't include standard parser if hush is used
507    8d640a7 mmc: sparc: Stop using builtin_run_command()
508    0c859a9 Rename run_command2() to run_command()
509    a74443f sandbox: Rename run_command() to builtin_run_command()
510
511The first patch is some test things that enable your code to be compiled,
512but that you don't want to submit because there is an existing patch for it
513on the list. So you can tell patman to create and check some patches
514(skipping the first patch) with:
515
516.. code-block:: bash
517
518    patman -s1 send -n
519
520If you want to do all of them including the work-in-progress one, then
521(if you are tracking an upstream branch):
522
523.. code-block:: bash
524
525    patman send -n
526
527Let's say that patman reports an error in the second patch. Then:
528
529.. code-block:: bash
530
531    git rebase -i HEAD~6
532    # change 'pick' to 'edit' in 89234f5
533    # use editor to make code changes
534    git add -u
535    git rebase --continue
536
537Now you have an updated patch series. To check it:
538
539.. code-block:: bash
540
541    patman -s1 send -n
542
543Let's say it is now clean and you want to send it. Now you need to set up
544the destination. So amend the top commit with:
545
546.. code-block:: bash
547
548    git commit --amend
549
550Use your editor to add some tags, so that the whole commit message is::
551
552    The current run_command() is really only one of the options, with
553    hush providing the other. It really shouldn't be called directly
554    in case the hush parser is bring used, so rename this function to
555    better explain its purpose::
556
557    Series-to: u-boot
558    Series-cc: bfin, marex
559    Series-prefix: RFC
560    Cover-letter:
561    Unified command execution in one place
562
563    At present two parsers have similar code to execute commands. Also
564    cmd_usage() is called all over the place. This series adds a single
565    function which processes commands called cmd_process().
566    END
567
568    Change-Id: Ica71a14c1f0ecb5650f771a32fecb8d2eb9d8a17
569
570
571You want this to be an RFC and Cc the whole series to the bfin alias and
572to Marek. Two of the patches have tags (those are the bits at the front of
573the subject that say mmc: sparc: and sandbox:), so 8d640a7 will be Cc'd to
574mmc and sparc, and the last one to sandbox.
575
576Now to send the patches, take off the -n flag:
577
578.. code-block:: bash
579
580   patman -s1 send
581
582The patches will be created, shown in your editor, and then sent along with
583the cover letter. Note that patman's tags are automatically removed so that
584people on the list don't see your secret info.
585
586Of course patches often attract comments and you need to make some updates.
587Let's say one person sent comments and you get an Acked-by: on one patch.
588Also, the patch on the list that you were waiting for has been merged,
589so you can drop your wip commit.
590
591Take a look on patchwork and find out the URL of the series. This will be
592something like `http://patchwork.ozlabs.org/project/uboot/list/?series=187331`
593Add this to a tag in your top commit::
594
595   Series-links: 187331
596
597You can use then patman to collect the Acked-by tag to the correct commit,
598creating a new 'version 2' branch for us-cmd:
599
600.. code-block:: bash
601
602    patman status -d us-cmd2
603    git checkout us-cmd2
604
605You can look at the comments in Patchwork or with:
606
607.. code-block:: bash
608
609    patman status -C
610
611Then you can resync with upstream:
612
613.. code-block:: bash
614
615    git fetch origin        # or whatever upstream is called
616    git rebase origin/master
617
618and use git rebase -i to edit the commits, dropping the wip one.
619
620Then update the `Series-cc:` in the top commit to add the person who reviewed
621the v1 series::
622
623    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
624
625and remove the Series-prefix: tag since it it isn't an RFC any more. The
626series is now version two, so the series info in the top commit looks like
627this::
628
629    Series-to: u-boot
630    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
631    Series-version: 2
632    Cover-letter:
633    ...
634
635Finally, you need to add a change log to the two commits you changed. You
636add change logs to each individual commit where the changes happened, like
637this::
638
639    Series-changes: 2
640    - Updated the command decoder to reduce code size
641    - Wound the torque propounder up a little more
642
643(note the blank line at the end of the list)
644
645When you run patman it will collect all the change logs from the different
646commits and combine them into the cover letter, if you have one. So finally
647you have a new series of commits::
648
649    faeb973 Don't include standard parser if hush is used
650    1b2f2fe mmc: sparc: Stop using builtin_run_command()
651    cfbe330 Rename run_command2() to run_command()
652    0682677 sandbox: Rename run_command() to builtin_run_command()
653
654so to send them:
655
656.. code-block:: bash
657
658    patman
659
660and it will create and send the version 2 series.
661
662
663Series Management
664-----------------
665
666Sometimes you might have several series in flight at the same time. Each of
667these receives comments and you want to create a new version of each series with
668those comments addressed.
669
670Patman provides a few subcommands which are helpful for managing series.
671
672Series and branches
673~~~~~~~~~~~~~~~~~~~
674
675'patman series' works with the concept of a series. It maintains a local
676database (.patman.db in your top-level git tree) and uses that to keep track of
677series and patches.
678
679Each series goes through muliple versions. Patman requires that the first
680version of your series is in a branch without a numeric suffix. Branch names
681like 'serial' and 'video' are OK, but 'part3' is not. This is because Patman
682uses the number at the end of the branch name to indicate the version.
683
684If your series name is 'video', then you can have a 'video' branch for version
6851 of the series, 'video2' for version 2 and 'video3' for version 3. All three
686branches are for the same series. Patman keeps track of these different
687versions. It handles the branch naming automatically, but you need to be aware
688of what it is doing.
689
690You will have an easier time if the branch names you use with 'patman series'
691are short, no more than 15 characters. This is the amount of columnar space in
692listings. You can add a longer description as the series description. If you
693are used to having very descriptive branch names, remember that patman lets you
694add metadata into commit which is automatically removed before sending.
695
696This documentation uses the term 'series' to mean all the versions of a series
697and 'series/version' to mean a particular version of a series.
698
699Updating commits
700~~~~~~~~~~~~~~~~
701
702Since Patman provides quite a bit of automation, it updates your commits in
703some cases, effectively doing a rebase of a branch in order to change the tags
704in the commits. It never makes code changes.
705
706In extremis you can use 'git reflog' to revert something that Patman did.
707
708
709Series subcommands
710~~~~~~~~~~~~~~~~~~
711
712Note that 'patman series ...' can be abbreviated as 'patman s' or 'patman ser'.
713
714Here is a short overview of the available subcommands:
715
716    add
717        Add a new series. Use this on an existing branch to tell Patman about it.
718
719    archive (ar)
720        Archive a series when you have finished upstreaming it. Archived series
721        are not shown by most commands. This creates a dated tag for each
722        version of the series, pointing to the series branch, then deletes the
723        branches. It puts the tag names in the database so that it can
724        'unarchive' to restore things how they were.
725
726    unarchive (unar)
727        Unarchive a series when you decide you need to do something more with
728        it. The branches are restored and tags deleted.
729
730    autolink (au)
731        Search patchwork for the series link for your series, so Patman can
732        track the status
733
734    autolink-all
735        Same but for all series
736
737    inc
738        Increase the series number, effectively creating a new branch with the
739        next highest version number. The new branch is created based on the
740        existing branch. So if you use 'patman series inc' on branch 'video2'
741        it will create branch 'video3' and add v3 into its database
742
743    dec
744        Decrease the series number, thus deleting the current branch and
745        removing that version from the data. If you use this comment on branch
746        'video3' Patman will delete version 3 and branch 'video3'.
747
748    get-link
749        Shows the Patchwork link for a series/version
750
751    ls
752        Lists the series in the database
753
754    mark
755        Mark a series with 'Change-Id' tags so that Patman can track patches
756        even when the subject changes. Unmarked patches just use the subject to
757        decided which is which.
758
759    unmark
760        Remove 'Change-Id' tags from a series.
761
762    open (o)
763        Open a series in Patchwork using your web browser
764
765    patches
766        Show the patches in a particular series/version
767
768    progress (p)
769        Show upstream progress for your series, or for all series
770
771    rm
772        Remove a series entirely, including all versions
773
774    rm-version (rmv)
775        Remove a particular version of a series. This is similar to 'dec'
776        except that any version can be removed, not just the latest one.
777
778    scan
779        Scan the local branch and update the database with the set of patches
780        in that branch. This throws away the old patches.
781
782    send
783        Send a series out as patches. This is similar to 'patman send' except
784        that it can send any series, not just the current branch. It also
785        waits a little for patchwork to see the cover letter, so it can find
786        out the patchwork link for the series.
787
788    set-link
789        Sets the Patchwork link for a series-version manually.
790
791    status (st)
792        Run 'patman status' on a series. This is similar to 'patman status'
793        except that it can get status on any series, not just the current
794        branch
795
796    summary
797        Shows a quick summary of series with their status and description.
798
799    sync
800        Sync the status of a series with Pathwork, so that
801        'patman series progress' can show the right information.
802
803    sync-all
804        Sync the status of all series.
805
806
807Patman series workflow
808~~~~~~~~~~~~~~~~~~~~~~
809
810Here is a run-through of how to incorporate 'patman series' into your workflow.
811
812Firstly, set up your project::
813
814    patman patchwork set-project U-Boot
815
816This just tells Patman to look on the Patchwork server for a project of that
817name. Internally Patman stores the ID and URL 'link-name' for the project, so it
818can access it.
819
820If you need to use a different patchwork server, use the `--patchwork-url`
821option or put the URL in your Patman-settings file.
822
823Now create a branch. For our example we are going to send out a series related
824to video so the branch will be called 'video'. The upstream remove is called
825'us'::
826
827    git checkout -b video us/master
828
829We now have a branch and so we can do some commits::
830
831    <edit files>
832    git add ...
833    <edit files>
834    git add -u
835    git commit ...
836    git commit ...
837
838We now have a few commits in our 'video' branch. Let's tell patman about it::
839
840    patman series add
841
842Like most commands, if no series is given (`patman series -s video add`) then
843the current branch is assumed. Since the branch is called 'video' patman knows
844that it is version one of the video series.
845
846You'll likely get a warning that there is no cover letter. Let's add some tags
847to the top commit::
848
849    Series-to: u-boot
850    Series-cc: ...
851    Cover-letter:
852    video: Improve syncing performance with cyclic
853
854Trying again::
855
856    patman series add
857
858You'll likely get a warning that the commits are unmarked. You can either let
859patman add Change-Id values itself with the `-m` flag, or tell it not to worry
860about it with `-M`. You must choose one or the other. Let's leave the commits
861unmarked::
862
863    patman series add -M
864
865Congratulations, you've now got a patman database!
866
867Now let's send out the series. We will add tags to the top commit.
868
869To send it::
870
871    patman series send
872
873You should send 'git send-email' start up and you can confirm the sending of
874each email.
875
876After that, patman waits a bit to see if it can find your new series appearing
877on Patchwork. With a bit of luck this will only take 20 seconds or so. Then your
878series is linked.
879
880To gather tags (Reviewed-by ...) for your series from patchwork::
881
882    patman series gather
883
884Now you can check your progress::
885
886    patman series progress
887
888Later on you get some comments, or perhaps you just decide to make a change on
889your own. You have several options.
890
891The first option is that you can just create a new branch::
892
893    git checkout -b video2 video
894
895then you can add this 'v2' series to Patman with::
896
897    patman series add
898
899The second option is to get patman to create the new 'video2' branch in one
900step::
901
902    patman inc
903
904The third option is to collect some tags using the 'patman status' command and
905put them in a new branch::
906
907    patman status -d video2
908
909One day the fourth option will be to ask patman to collect tags as part of the
910'patman inc' command.
911
912Again, you do your edits, perhaps adding/removing patches, rebasing on -master
913and so on. Then, send your v2::
914
915    patman series send
916
917Let's say the patches are accepted. You can use::
918
919    patch series gather
920    patch series progress
921
922to check, or::
923
924    patman series status -cC
925
926to see comments. You can now archive the series::
927
928    patman series archive
929
930At this point you have the basics. Some of the subcommands useful options, so
931be sure to check out the help.
932
933Here is a sample 'progress' view:
934
935.. image:: pics/patman.jpg
936  :width: 800
937  :alt: Patman showing the progress view
938
939General points
940--------------
941
942#. When you change back to the us-cmd branch days or weeks later all your
943   information is still there, safely stored in the commits. You don't need
944   to remember what version you are up to, who you sent the last lot of patches
945   to, or anything about the change logs.
946#. If you put tags in the subject, patman will Cc the maintainers
947   automatically in many cases.
948#. If you want to keep the commits from each series you sent so that you can
949   compare change and see what you did, you can either create a new branch for
950   each version, or just tag the branch before you start changing it:
951
952   .. code-block:: bash
953
954        git tag sent/us-cmd-rfc
955        # ...later...
956        git tag sent/us-cmd-v2
957
958#. If you want to modify the patches a little before sending, you can do
959   this in your editor, but be careful!
960#. If you want to run git send-email yourself, use the -n flag which will
961   print out the command line patman would have used.
962#. It is a good idea to add the change log info as you change the commit,
963   not later when you can't remember which patch you changed. You can always
964   go back and change or remove logs from commits.
965#. Some mailing lists have size limits and when we add binary contents to
966   our patches it's easy to exceed the size limits. Use "--no-binary" to
967   generate patches without any binary contents. You are supposed to include
968   a link to a git repository in your "Commit-notes", "Series-notes" or
969   "Cover-letter" for maintainers to fetch the original commit.
970#. Patches will have no changelog entries for revisions where they did not
971   change. For clarity, if there are no changes for this patch in the most
972   recent revision of the series, a note will be added. For example, a patch
973   with the following tags in the commit::
974
975        Series-version: 5
976        Series-changes: 2
977        - Some change
978
979        Series-changes: 4
980        - Another change
981
982   would have a changelog of:::
983
984        (no changes since v4)
985
986        Changes in v4:
987        - Another change
988
989        Changes in v2:
990        - Some change
991
992
993Other thoughts
994--------------
995
996This script has been split into sensible files but still needs work.
997Most of these are indicated by a TODO in the code.
998
999It would be nice if this could handle the In-reply-to side of things.
1000
1001The tests are incomplete, as is customary. Use the 'test' subcommand to run
1002them:
1003
1004.. code-block:: bash
1005
1006    $ tools/patman/patman test
1007
1008Note that since the test suite depends on data files only available in
1009the git checkout, the `test` command is hidden unless `patman` is
1010invoked from the U-Boot git repository.
1011
1012Alternatively, you can run the test suite via Pytest:
1013
1014.. code-block:: bash
1015
1016    $ cd tools/patman && pytest
1017
1018Error handling doesn't always produce friendly error messages - e.g.
1019putting an incorrect tag in a commit may provide a confusing message.
1020
1021There might be a few other features not mentioned in this README. They
1022might be bugs. In particular, tags are case sensitive which is probably
1023a bad thing.
1024