xref: /rk3399_rockchip-uboot/tools/patman/README (revision ad6e7aa6ce528362247ba7596accdde9f5ce13bf)
10d24de9dSSimon Glass# Copyright (c) 2011 The Chromium OS Authors.
20d24de9dSSimon Glass#
31a459660SWolfgang Denk# SPDX-License-Identifier:	GPL-2.0+
40d24de9dSSimon Glass#
50d24de9dSSimon Glass
60d24de9dSSimon GlassWhat is this?
70d24de9dSSimon Glass=============
80d24de9dSSimon Glass
90d24de9dSSimon GlassThis tool is a Python script which:
100d24de9dSSimon Glass- Creates patch directly from your branch
110d24de9dSSimon Glass- Cleans them up by removing unwanted tags
120d24de9dSSimon Glass- Inserts a cover letter with change lists
130d24de9dSSimon Glass- Runs the patches through checkpatch.pl and its own checks
140d24de9dSSimon Glass- Optionally emails them out to selected people
150d24de9dSSimon Glass
160d24de9dSSimon GlassIt is intended to automate patch creation and make it a less
170d24de9dSSimon Glasserror-prone process. It is useful for U-Boot and Linux work so far,
180d24de9dSSimon Glasssince it uses the checkpatch.pl script.
190d24de9dSSimon Glass
200d24de9dSSimon GlassIt is configured almost entirely by tags it finds in your commits.
210d24de9dSSimon GlassThis means that you can work on a number of different branches at
220d24de9dSSimon Glassonce, and keep the settings with each branch rather than having to
230d24de9dSSimon Glassgit format-patch, git send-email, etc. with the correct parameters
240d24de9dSSimon Glasseach time. So for example if you put:
250d24de9dSSimon Glass
260d24de9dSSimon GlassSeries-to: fred.blogs@napier.co.nz
270d24de9dSSimon Glass
280d24de9dSSimon Glassin one of your commits, the series will be sent there.
290d24de9dSSimon Glass
30983a2749SSimon GlassIn Linux and U-Boot this will also call get_maintainer.pl on each of your
31983a2749SSimon Glasspatches automatically (unless you use -m to disable this).
3221a19d70SDoug Anderson
330d24de9dSSimon Glass
340d24de9dSSimon GlassHow to use this tool
350d24de9dSSimon Glass====================
360d24de9dSSimon Glass
370d24de9dSSimon GlassThis tool requires a certain way of working:
380d24de9dSSimon Glass
390d24de9dSSimon Glass- Maintain a number of branches, one for each patch series you are
400d24de9dSSimon Glassworking on
410d24de9dSSimon Glass- Add tags into the commits within each branch to indicate where the
420d24de9dSSimon Glassseries should be sent, cover letter, version, etc. Most of these are
430d24de9dSSimon Glassnormally in the top commit so it is easy to change them with 'git
440d24de9dSSimon Glasscommit --amend'
450d24de9dSSimon Glass- Each branch tracks the upstream branch, so that this script can
460d24de9dSSimon Glassautomatically determine the number of commits in it (optional)
470d24de9dSSimon Glass- Check out a branch, and run this script to create and send out your
480d24de9dSSimon Glasspatches. Weeks later, change the patches and repeat, knowing that you
490d24de9dSSimon Glasswill get a consistent result each time.
500d24de9dSSimon Glass
510d24de9dSSimon Glass
520d24de9dSSimon GlassHow to configure it
530d24de9dSSimon Glass===================
540d24de9dSSimon Glass
553d4de986SSimon GlassFor most cases of using patman for U-Boot development, patman can use the
563d4de986SSimon Glassfile 'doc/git-mailrc' in your U-Boot directory to supply the email aliases
573d4de986SSimon Glassyou need. To make this work, tell git where to find the file by typing
583d4de986SSimon Glassthis once:
5921a19d70SDoug Anderson
603d4de986SSimon Glass    git config sendemail.aliasesfile doc/git-mailrc
613d4de986SSimon Glass
623d4de986SSimon GlassFor both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
633d4de986SSimon Glassout where to send patches pretty well.
640d24de9dSSimon Glass
6587d65558SVikram NarayananDuring the first run patman creates a config file for you by taking the default
6687d65558SVikram Narayananuser name and email address from the global .gitconfig file.
6787d65558SVikram Narayanan
682b36c75dSVikram NarayananTo add your own, create a file ~/.patman like this:
690d24de9dSSimon Glass
700d24de9dSSimon Glass>>>>
710d24de9dSSimon Glass# patman alias file
720d24de9dSSimon Glass
730d24de9dSSimon Glass[alias]
740d24de9dSSimon Glassme: Simon Glass <sjg@chromium.org>
750d24de9dSSimon Glass
760d24de9dSSimon Glassu-boot: U-Boot Mailing List <u-boot@lists.denx.de>
770d24de9dSSimon Glasswolfgang: Wolfgang Denk <wd@denx.de>
780d24de9dSSimon Glassothers: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
790d24de9dSSimon Glass
800d24de9dSSimon Glass<<<<
810d24de9dSSimon Glass
820d24de9dSSimon GlassAliases are recursive.
830d24de9dSSimon Glass
840d24de9dSSimon GlassThe checkpatch.pl in the U-Boot tools/ subdirectory will be located and
850d24de9dSSimon Glassused. Failing that you can put it into your path or ~/bin/checkpatch.pl
860d24de9dSSimon Glass
87*ad6e7aa6SChris PackhamIf you want to avoid sending patches to email addresses that are picked up
88*ad6e7aa6SChris Packhamby patman but are known to bounce you can add a [bounces] section to your
89*ad6e7aa6SChris Packham.patman file. Unlike the [alias] section these are simple key: value pairs
90*ad6e7aa6SChris Packhamthat are not recursive.
91*ad6e7aa6SChris Packham
92*ad6e7aa6SChris Packham>>>
93*ad6e7aa6SChris Packham
94*ad6e7aa6SChris Packham[bounces]
95*ad6e7aa6SChris Packhamgonefishing: Fred Bloggs <f.bloggs@napier.net>
96*ad6e7aa6SChris Packham
97*ad6e7aa6SChris Packham<<<
98*ad6e7aa6SChris Packham
990d24de9dSSimon Glass
1008568baedSDoug AndersonIf you want to change the defaults for patman's command-line arguments,
1018568baedSDoug Andersonyou can add a [settings] section to your .patman file.  This can be used
1028568baedSDoug Andersonfor any command line option by referring to the "dest" for the option in
1038568baedSDoug Andersonpatman.py.  For reference, the useful ones (at the moment) shown below
1048568baedSDoug Anderson(all with the non-default setting):
1058568baedSDoug Anderson
1068568baedSDoug Anderson>>>
1078568baedSDoug Anderson
1088568baedSDoug Anderson[settings]
1098568baedSDoug Andersonignore_errors: True
1108568baedSDoug Andersonprocess_tags: False
1118568baedSDoug Andersonverbose: True
1128568baedSDoug Anderson
1138568baedSDoug Anderson<<<
1148568baedSDoug Anderson
1158568baedSDoug Anderson
116a1dcee84SDoug AndersonIf you want to adjust settings (or aliases) that affect just a single
117a1dcee84SDoug Andersonproject you can add a section that looks like [project_settings] or
118a1dcee84SDoug Anderson[project_alias].  If you want to use tags for your linux work, you could
119a1dcee84SDoug Andersondo:
120a1dcee84SDoug Anderson
121a1dcee84SDoug Anderson>>>
122a1dcee84SDoug Anderson
123a1dcee84SDoug Anderson[linux_settings]
124a1dcee84SDoug Andersonprocess_tags: True
125a1dcee84SDoug Anderson
126a1dcee84SDoug Anderson<<<
127a1dcee84SDoug Anderson
128a1dcee84SDoug Anderson
1290d24de9dSSimon GlassHow to run it
1300d24de9dSSimon Glass=============
1310d24de9dSSimon Glass
1320d24de9dSSimon GlassFirst do a dry run:
1330d24de9dSSimon Glass
134330a091cSVikram Narayanan$ ./tools/patman/patman -n
1350d24de9dSSimon Glass
1360d24de9dSSimon GlassIf it can't detect the upstream branch, try telling it how many patches
1370d24de9dSSimon Glassthere are in your series:
1380d24de9dSSimon Glass
139330a091cSVikram Narayanan$ ./tools/patman/patman -n -c5
1400d24de9dSSimon Glass
1410d24de9dSSimon GlassThis will create patch files in your current directory and tell you who
1420d24de9dSSimon Glassit is thinking of sending them to. Take a look at the patch files.
1430d24de9dSSimon Glass
144330a091cSVikram Narayanan$ ./tools/patman/patman -n -c5 -s1
1450d24de9dSSimon Glass
1460d24de9dSSimon GlassSimilar to the above, but skip the first commit and take the next 5. This
1470d24de9dSSimon Glassis useful if your top commit is for setting up testing.
1480d24de9dSSimon Glass
1490d24de9dSSimon Glass
150488d19cbSChris PackhamHow to install it
151488d19cbSChris Packham=================
152488d19cbSChris Packham
153a187559eSBin MengThe most up to date version of patman can be found in the U-Boot sources.
154488d19cbSChris PackhamHowever to use it on other projects it may be more convenient to install it as
155488d19cbSChris Packhama standalone application. A distutils installer is included, this can be used
156488d19cbSChris Packhamto install patman:
157488d19cbSChris Packham
158488d19cbSChris Packham$ cd tools/patman && python setup.py install
159488d19cbSChris Packham
160488d19cbSChris Packham
1610d24de9dSSimon GlassHow to add tags
1620d24de9dSSimon Glass===============
1630d24de9dSSimon Glass
1640d24de9dSSimon GlassTo make this script useful you must add tags like the following into any
1650d24de9dSSimon Glasscommit. Most can only appear once in the whole series.
1660d24de9dSSimon Glass
1670d24de9dSSimon GlassSeries-to: email / alias
1680d24de9dSSimon Glass	Email address / alias to send patch series to (you can add this
1690d24de9dSSimon Glass	multiple times)
1700d24de9dSSimon Glass
1710d24de9dSSimon GlassSeries-cc: email / alias, ...
1720d24de9dSSimon Glass	Email address / alias to Cc patch series to (you can add this
1730d24de9dSSimon Glass	multiple times)
1740d24de9dSSimon Glass
1750d24de9dSSimon GlassSeries-version: n
1760d24de9dSSimon Glass	Sets the version number of this patch series
1770d24de9dSSimon Glass
1780d24de9dSSimon GlassSeries-prefix: prefix
1790d24de9dSSimon Glass	Sets the subject prefix. Normally empty but it can be RFC for
1803871cd85SWu, Josh	RFC patches, or RESEND if you are being ignored. The patch subject
1813871cd85SWu, Josh	is like [RFC PATCH] or [RESEND PATCH].
1823871cd85SWu, Josh	In the meantime, git format.subjectprefix option will be added as
1833871cd85SWu, Josh	well. If your format.subjectprefix is set to InternalProject, then
1843871cd85SWu, Josh	the patch shows like: [InternalProject][RFC/RESEND PATCH]
1850d24de9dSSimon Glass
186ef0e9de8SSimon GlassSeries-name: name
187ef0e9de8SSimon Glass	Sets the name of the series. You don't need to have a name, and
188ef0e9de8SSimon Glass	patman does not yet use it, but it is convenient to put the branch
189ef0e9de8SSimon Glass	name here to help you keep track of multiple upstreaming efforts.
190ef0e9de8SSimon Glass
1910d24de9dSSimon GlassCover-letter:
1920d24de9dSSimon GlassThis is the patch set title
1930d24de9dSSimon Glassblah blah
1940d24de9dSSimon Glassmore blah blah
1950d24de9dSSimon GlassEND
1960d24de9dSSimon Glass	Sets the cover letter contents for the series. The first line
1970d24de9dSSimon Glass	will become the subject of the cover letter
1980d24de9dSSimon Glass
199fe2f8d9eSSimon GlassCover-letter-cc: email / alias
200fe2f8d9eSSimon Glass	Additional email addresses / aliases to send cover letter to (you
201fe2f8d9eSSimon Glass	can add this multiple times)
202fe2f8d9eSSimon Glass
2030d24de9dSSimon GlassSeries-notes:
2040d24de9dSSimon Glassblah blah
2050d24de9dSSimon Glassblah blah
2060d24de9dSSimon Glassmore blah blah
2070d24de9dSSimon GlassEND
2080d24de9dSSimon Glass	Sets some notes for the patch series, which you don't want in
2090d24de9dSSimon Glass	the commit messages, but do want to send, The notes are joined
2100d24de9dSSimon Glass	together and put after the cover letter. Can appear multiple
2110d24de9dSSimon Glass	times.
2120d24de9dSSimon Glass
2135c8fdd91SAlbert ARIBAUDCommit-notes:
2145c8fdd91SAlbert ARIBAUDblah blah
2155c8fdd91SAlbert ARIBAUDblah blah
2165c8fdd91SAlbert ARIBAUDmore blah blah
2175c8fdd91SAlbert ARIBAUDEND
2185c8fdd91SAlbert ARIBAUD	Similar, but for a single commit (patch). These notes will appear
2195c8fdd91SAlbert ARIBAUD	immediately below the --- cut in the patch file.
2205c8fdd91SAlbert ARIBAUD
2210d24de9dSSimon Glass Signed-off-by: Their Name <email>
2220d24de9dSSimon Glass	A sign-off is added automatically to your patches (this is
2230d24de9dSSimon Glass	probably a bug). If you put this tag in your patches, it will
2240d24de9dSSimon Glass	override the default signoff that patman automatically adds.
225102061bdSSimon Glass	Multiple duplicate signoffs will be removed.
2260d24de9dSSimon Glass
2270d24de9dSSimon Glass Tested-by: Their Name <email>
22828b3594eSDoug Anderson Reviewed-by: Their Name <email>
2290d24de9dSSimon Glass Acked-by: Their Name <email>
23028b3594eSDoug Anderson	These indicate that someone has tested/reviewed/acked your patch.
2310d24de9dSSimon Glass	When you get this reply on the mailing list, you can add this
2320d24de9dSSimon Glass	tag to the relevant commit and the script will include it when
2330d24de9dSSimon Glass	you send out the next version. If 'Tested-by:' is set to
2340d24de9dSSimon Glass	yourself, it will be removed. No one will believe you.
2350d24de9dSSimon Glass
2360d24de9dSSimon GlassSeries-changes: n
2370d24de9dSSimon Glass- Guinea pig moved into its cage
2380d24de9dSSimon Glass- Other changes ending with a blank line
2390d24de9dSSimon Glass<blank line>
2400d24de9dSSimon Glass	This can appear in any commit. It lists the changes for a
2410d24de9dSSimon Glass	particular version n of that commit. The change list is
2420d24de9dSSimon Glass	created based on this information. Each commit gets its own
2430d24de9dSSimon Glass	change list and also the whole thing is repeated in the cover
2440d24de9dSSimon Glass	letter (where duplicate change lines are merged).
2450d24de9dSSimon Glass
2460d24de9dSSimon Glass	By adding your change lists into your commits it is easier to
2470d24de9dSSimon Glass	keep track of what happened. When you amend a commit, remember
2480d24de9dSSimon Glass	to update the log there and then, knowing that the script will
2490d24de9dSSimon Glass	do the rest.
2500d24de9dSSimon Glass
251659c89daSSimon GlassPatch-cc: Their Name <email>
252659c89daSSimon Glass	This copies a single patch to another email address. Note that the
253659c89daSSimon Glass	Cc: used by git send-email is ignored by patman, but will be
254659c89daSSimon Glass	interpreted by git send-email if you use it.
255645b271aSSimon Glass
256645b271aSSimon GlassSeries-process-log: sort, uniq
257645b271aSSimon Glass	This tells patman to sort and/or uniq the change logs. It is
258645b271aSSimon Glass	assumed that each change log entry is only a single line long.
259645b271aSSimon Glass	Use 'sort' to sort the entries, and 'uniq' to include only
260645b271aSSimon Glass	unique entries. If omitted, no change log processing is done.
261645b271aSSimon Glass	Separate each tag with a comma.
2620d24de9dSSimon Glass
2630d24de9dSSimon GlassVarious other tags are silently removed, like these Chrome OS and
2640d24de9dSSimon GlassGerrit tags:
2650d24de9dSSimon Glass
2660d24de9dSSimon GlassBUG=...
2670d24de9dSSimon GlassTEST=...
2680d24de9dSSimon GlassChange-Id:
2690d24de9dSSimon GlassReview URL:
2700d24de9dSSimon GlassReviewed-on:
2715c8fdd91SAlbert ARIBAUDCommit-xxxx: (except Commit-notes)
2720d24de9dSSimon Glass
2730d24de9dSSimon GlassExercise for the reader: Try adding some tags to one of your current
2740d24de9dSSimon Glasspatch series and see how the patches turn out.
2750d24de9dSSimon Glass
2760d24de9dSSimon Glass
2770d24de9dSSimon GlassWhere Patches Are Sent
2780d24de9dSSimon Glass======================
2790d24de9dSSimon Glass
2801713247fSVikram NarayananOnce the patches are created, patman sends them using git send-email. The
2810d24de9dSSimon Glasswhole series is sent to the recipients in Series-to: and Series-cc.
282659c89daSSimon GlassYou can Cc individual patches to other people with the Patch-cc: tag. Tags
283659c89daSSimon Glassin the subject are also picked up to Cc patches. For example, a commit like
284659c89daSSimon Glassthis:
2850d24de9dSSimon Glass
2860d24de9dSSimon Glass>>>>
2870d24de9dSSimon Glasscommit 10212537b85ff9b6e09c82045127522c0f0db981
2880d24de9dSSimon GlassAuthor: Mike Frysinger <vapier@gentoo.org>
2890d24de9dSSimon GlassDate:	Mon Nov 7 23:18:44 2011 -0500
2900d24de9dSSimon Glass
2910d24de9dSSimon Glass    x86: arm: add a git mailrc file for maintainers
2920d24de9dSSimon Glass
2930d24de9dSSimon Glass    This should make sending out e-mails to the right people easier.
2940d24de9dSSimon Glass
295659c89daSSimon Glass    Patch-cc: sandbox, mikef, ag
296659c89daSSimon Glass    Patch-cc: afleming
2970d24de9dSSimon Glass<<<<
2980d24de9dSSimon Glass
2990d24de9dSSimon Glasswill create a patch which is copied to x86, arm, sandbox, mikef, ag and
3000d24de9dSSimon Glassafleming.
3010d24de9dSSimon Glass
302659c89daSSimon GlassIf you have a cover letter it will get sent to the union of the Patch-cc
303659c89daSSimon Glasslists of all of the other patches. If you want to sent it to additional
304659c89daSSimon Glasspeople you can add a tag:
305fe2f8d9eSSimon Glass
306fe2f8d9eSSimon GlassCover-letter-cc: <list of addresses>
307fe2f8d9eSSimon Glass
308fe2f8d9eSSimon GlassThese people will get the cover letter even if they are not on the To/Cc
309fe2f8d9eSSimon Glasslist for any of the patches.
31031187255SDoug Anderson
3110d24de9dSSimon Glass
3120d24de9dSSimon GlassExample Work Flow
3130d24de9dSSimon Glass=================
3140d24de9dSSimon Glass
3150d24de9dSSimon GlassThe basic workflow is to create your commits, add some tags to the top
3160d24de9dSSimon Glasscommit, and type 'patman' to check and send them.
3170d24de9dSSimon Glass
3180d24de9dSSimon GlassHere is an example workflow for a series of 4 patches. Let's say you have
3190d24de9dSSimon Glassthese rather contrived patches in the following order in branch us-cmd in
3200d24de9dSSimon Glassyour tree where 'us' means your upstreaming activity (newest to oldest as
3210d24de9dSSimon Glassoutput by git log --oneline):
3220d24de9dSSimon Glass
3230d24de9dSSimon Glass    7c7909c wip
3240d24de9dSSimon Glass    89234f5 Don't include standard parser if hush is used
3250d24de9dSSimon Glass    8d640a7 mmc: sparc: Stop using builtin_run_command()
3260d24de9dSSimon Glass    0c859a9 Rename run_command2() to run_command()
3270d24de9dSSimon Glass    a74443f sandbox: Rename run_command() to builtin_run_command()
3280d24de9dSSimon Glass
3290d24de9dSSimon GlassThe first patch is some test things that enable your code to be compiled,
3300d24de9dSSimon Glassbut that you don't want to submit because there is an existing patch for it
3310d24de9dSSimon Glasson the list. So you can tell patman to create and check some patches
3320d24de9dSSimon Glass(skipping the first patch) with:
3330d24de9dSSimon Glass
3340d24de9dSSimon Glass    patman -s1 -n
3350d24de9dSSimon Glass
3360d24de9dSSimon GlassIf you want to do all of them including the work-in-progress one, then
3370d24de9dSSimon Glass(if you are tracking an upstream branch):
3380d24de9dSSimon Glass
3390d24de9dSSimon Glass    patman -n
3400d24de9dSSimon Glass
3410d24de9dSSimon GlassLet's say that patman reports an error in the second patch. Then:
3420d24de9dSSimon Glass
3430d24de9dSSimon Glass    git rebase -i HEAD~6
3440d24de9dSSimon Glass    <change 'pick' to 'edit' in 89234f5>
3450d24de9dSSimon Glass    <use editor to make code changes>
3460d24de9dSSimon Glass    git add -u
3470d24de9dSSimon Glass    git rebase --continue
3480d24de9dSSimon Glass
3490d24de9dSSimon GlassNow you have an updated patch series. To check it:
3500d24de9dSSimon Glass
3510d24de9dSSimon Glass    patman -s1 -n
3520d24de9dSSimon Glass
3530d24de9dSSimon GlassLet's say it is now clean and you want to send it. Now you need to set up
3540d24de9dSSimon Glassthe destination. So amend the top commit with:
3550d24de9dSSimon Glass
3560d24de9dSSimon Glass    git commit --amend
3570d24de9dSSimon Glass
3580d24de9dSSimon GlassUse your editor to add some tags, so that the whole commit message is:
3590d24de9dSSimon Glass
3600d24de9dSSimon Glass    The current run_command() is really only one of the options, with
3610d24de9dSSimon Glass    hush providing the other. It really shouldn't be called directly
3620d24de9dSSimon Glass    in case the hush parser is bring used, so rename this function to
3630d24de9dSSimon Glass    better explain its purpose.
3640d24de9dSSimon Glass
3650d24de9dSSimon Glass    Series-to: u-boot
3660d24de9dSSimon Glass    Series-cc: bfin, marex
3670d24de9dSSimon Glass    Series-prefix: RFC
3680d24de9dSSimon Glass    Cover-letter:
3690d24de9dSSimon Glass    Unified command execution in one place
3700d24de9dSSimon Glass
3710d24de9dSSimon Glass    At present two parsers have similar code to execute commands. Also
3720d24de9dSSimon Glass    cmd_usage() is called all over the place. This series adds a single
3730d24de9dSSimon Glass    function which processes commands called cmd_process().
3740d24de9dSSimon Glass    END
3750d24de9dSSimon Glass
3760d24de9dSSimon Glass    Change-Id: Ica71a14c1f0ecb5650f771a32fecb8d2eb9d8a17
3770d24de9dSSimon Glass
3780d24de9dSSimon Glass
3790d24de9dSSimon GlassYou want this to be an RFC and Cc the whole series to the bfin alias and
3800d24de9dSSimon Glassto Marek. Two of the patches have tags (those are the bits at the front of
3810d24de9dSSimon Glassthe subject that say mmc: sparc: and sandbox:), so 8d640a7 will be Cc'd to
3820d24de9dSSimon Glassmmc and sparc, and the last one to sandbox.
3830d24de9dSSimon Glass
3840d24de9dSSimon GlassNow to send the patches, take off the -n flag:
3850d24de9dSSimon Glass
3860d24de9dSSimon Glass   patman -s1
3870d24de9dSSimon Glass
3880d24de9dSSimon GlassThe patches will be created, shown in your editor, and then sent along with
3890d24de9dSSimon Glassthe cover letter. Note that patman's tags are automatically removed so that
3900d24de9dSSimon Glasspeople on the list don't see your secret info.
3910d24de9dSSimon Glass
3920d24de9dSSimon GlassOf course patches often attract comments and you need to make some updates.
3930d24de9dSSimon GlassLet's say one person sent comments and you get an Acked-by: on one patch.
3940d24de9dSSimon GlassAlso, the patch on the list that you were waiting for has been merged,
3950d24de9dSSimon Glassso you can drop your wip commit. So you resync with upstream:
3960d24de9dSSimon Glass
3970d24de9dSSimon Glass    git fetch origin		(or whatever upstream is called)
3980d24de9dSSimon Glass    git rebase origin/master
3990d24de9dSSimon Glass
4000d24de9dSSimon Glassand use git rebase -i to edit the commits, dropping the wip one. You add
4010d24de9dSSimon Glassthe ack tag to one commit:
4020d24de9dSSimon Glass
4030d24de9dSSimon Glass    Acked-by: Heiko Schocher <hs@denx.de>
4040d24de9dSSimon Glass
4050d24de9dSSimon Glassupdate the Series-cc: in the top commit:
4060d24de9dSSimon Glass
4070d24de9dSSimon Glass    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
4080d24de9dSSimon Glass
4090d24de9dSSimon Glassand remove the Series-prefix: tag since it it isn't an RFC any more. The
4100d24de9dSSimon Glassseries is now version two, so the series info in the top commit looks like
4110d24de9dSSimon Glassthis:
4120d24de9dSSimon Glass
4130d24de9dSSimon Glass    Series-to: u-boot
4140d24de9dSSimon Glass    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
4150d24de9dSSimon Glass    Series-version: 2
4160d24de9dSSimon Glass    Cover-letter:
4170d24de9dSSimon Glass    ...
4180d24de9dSSimon Glass
4190d24de9dSSimon GlassFinally, you need to add a change log to the two commits you changed. You
4200d24de9dSSimon Glassadd change logs to each individual commit where the changes happened, like
4210d24de9dSSimon Glassthis:
4220d24de9dSSimon Glass
4230d24de9dSSimon Glass    Series-changes: 2
4240d24de9dSSimon Glass    - Updated the command decoder to reduce code size
4250d24de9dSSimon Glass    - Wound the torque propounder up a little more
4260d24de9dSSimon Glass
4270d24de9dSSimon Glass(note the blank line at the end of the list)
4280d24de9dSSimon Glass
4290d24de9dSSimon GlassWhen you run patman it will collect all the change logs from the different
4300d24de9dSSimon Glasscommits and combine them into the cover letter, if you have one. So finally
4310d24de9dSSimon Glassyou have a new series of commits:
4320d24de9dSSimon Glass
4330d24de9dSSimon Glass    faeb973 Don't include standard parser if hush is used
4340d24de9dSSimon Glass    1b2f2fe mmc: sparc: Stop using builtin_run_command()
4350d24de9dSSimon Glass    cfbe330 Rename run_command2() to run_command()
4360d24de9dSSimon Glass    0682677 sandbox: Rename run_command() to builtin_run_command()
4370d24de9dSSimon Glass
4380d24de9dSSimon Glassso to send them:
4390d24de9dSSimon Glass
4400d24de9dSSimon Glass    patman
4410d24de9dSSimon Glass
4420d24de9dSSimon Glassand it will create and send the version 2 series.
4430d24de9dSSimon Glass
4440d24de9dSSimon GlassGeneral points:
4450d24de9dSSimon Glass
4460d24de9dSSimon Glass1. When you change back to the us-cmd branch days or weeks later all your
4470d24de9dSSimon Glassinformation is still there, safely stored in the commits. You don't need
4480d24de9dSSimon Glassto remember what version you are up to, who you sent the last lot of patches
4490d24de9dSSimon Glassto, or anything about the change logs.
4500d24de9dSSimon Glass
4510d24de9dSSimon Glass2. If you put tags in the subject, patman will Cc the maintainers
4520d24de9dSSimon Glassautomatically in many cases.
4530d24de9dSSimon Glass
4540d24de9dSSimon Glass3. If you want to keep the commits from each series you sent so that you can
4550d24de9dSSimon Glasscompare change and see what you did, you can either create a new branch for
4560d24de9dSSimon Glasseach version, or just tag the branch before you start changing it:
4570d24de9dSSimon Glass
4580d24de9dSSimon Glass    git tag sent/us-cmd-rfc
4590d24de9dSSimon Glass    ...later...
4600d24de9dSSimon Glass    git tag sent/us-cmd-v2
4610d24de9dSSimon Glass
4620d24de9dSSimon Glass4. If you want to modify the patches a little before sending, you can do
4630d24de9dSSimon Glassthis in your editor, but be careful!
4640d24de9dSSimon Glass
4650d24de9dSSimon Glass5. If you want to run git send-email yourself, use the -n flag which will
4660d24de9dSSimon Glassprint out the command line patman would have used.
4670d24de9dSSimon Glass
4680d24de9dSSimon Glass6. It is a good idea to add the change log info as you change the commit,
4690d24de9dSSimon Glassnot later when you can't remember which patch you changed. You can always
4700d24de9dSSimon Glassgo back and change or remove logs from commits.
4710d24de9dSSimon Glass
4720d24de9dSSimon Glass
4730d24de9dSSimon GlassOther thoughts
4740d24de9dSSimon Glass==============
4750d24de9dSSimon Glass
4760d24de9dSSimon GlassThis script has been split into sensible files but still needs work.
4770d24de9dSSimon GlassMost of these are indicated by a TODO in the code.
4780d24de9dSSimon Glass
4790d24de9dSSimon GlassIt would be nice if this could handle the In-reply-to side of things.
4800d24de9dSSimon Glass
481c8605bb4SGerhard SittigThe tests are incomplete, as is customary. Use the --test flag to run them,
482c8605bb4SGerhard Sittigand make sure you are in the tools/patman directory first:
4830d24de9dSSimon Glass
4840d24de9dSSimon Glass    $ cd /path/to/u-boot
485c8605bb4SGerhard Sittig    $ cd tools/patman
486c8605bb4SGerhard Sittig    $ ./patman --test
4870d24de9dSSimon Glass
4880d24de9dSSimon GlassError handling doesn't always produce friendly error messages - e.g.
4890d24de9dSSimon Glassputting an incorrect tag in a commit may provide a confusing message.
4900d24de9dSSimon Glass
4910d24de9dSSimon GlassThere might be a few other features not mentioned in this README. They
4920d24de9dSSimon Glassmight be bugs. In particular, tags are case sensitive which is probably
4930d24de9dSSimon Glassa bad thing.
4940d24de9dSSimon Glass
4950d24de9dSSimon Glass
4960d24de9dSSimon GlassSimon Glass <sjg@chromium.org>
4970d24de9dSSimon Glassv1, v2, 19-Oct-11
4980d24de9dSSimon Glassrevised v3 24-Nov-11
499