xref: /OK3568_Linux_fs/u-boot/tools/patman/README (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# Copyright (c) 2011 The Chromium OS Authors.
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# SPDX-License-Identifier:	GPL-2.0+
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunWhat is this?
7*4882a593Smuzhiyun=============
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThis tool is a Python script which:
10*4882a593Smuzhiyun- Creates patch directly from your branch
11*4882a593Smuzhiyun- Cleans them up by removing unwanted tags
12*4882a593Smuzhiyun- Inserts a cover letter with change lists
13*4882a593Smuzhiyun- Runs the patches through checkpatch.pl and its own checks
14*4882a593Smuzhiyun- Optionally emails them out to selected people
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunIt is intended to automate patch creation and make it a less
17*4882a593Smuzhiyunerror-prone process. It is useful for U-Boot and Linux work so far,
18*4882a593Smuzhiyunsince it uses the checkpatch.pl script.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunIt is configured almost entirely by tags it finds in your commits.
21*4882a593SmuzhiyunThis means that you can work on a number of different branches at
22*4882a593Smuzhiyunonce, and keep the settings with each branch rather than having to
23*4882a593Smuzhiyungit format-patch, git send-email, etc. with the correct parameters
24*4882a593Smuzhiyuneach time. So for example if you put:
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunSeries-to: fred.blogs@napier.co.nz
27*4882a593Smuzhiyun
28*4882a593Smuzhiyunin one of your commits, the series will be sent there.
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunIn Linux and U-Boot this will also call get_maintainer.pl on each of your
31*4882a593Smuzhiyunpatches automatically (unless you use -m to disable this).
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunHow to use this tool
35*4882a593Smuzhiyun====================
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunThis tool requires a certain way of working:
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun- Maintain a number of branches, one for each patch series you are
40*4882a593Smuzhiyunworking on
41*4882a593Smuzhiyun- Add tags into the commits within each branch to indicate where the
42*4882a593Smuzhiyunseries should be sent, cover letter, version, etc. Most of these are
43*4882a593Smuzhiyunnormally in the top commit so it is easy to change them with 'git
44*4882a593Smuzhiyuncommit --amend'
45*4882a593Smuzhiyun- Each branch tracks the upstream branch, so that this script can
46*4882a593Smuzhiyunautomatically determine the number of commits in it (optional)
47*4882a593Smuzhiyun- Check out a branch, and run this script to create and send out your
48*4882a593Smuzhiyunpatches. Weeks later, change the patches and repeat, knowing that you
49*4882a593Smuzhiyunwill get a consistent result each time.
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunHow to configure it
53*4882a593Smuzhiyun===================
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunFor most cases of using patman for U-Boot development, patman can use the
56*4882a593Smuzhiyunfile 'doc/git-mailrc' in your U-Boot directory to supply the email aliases
57*4882a593Smuzhiyunyou need. To make this work, tell git where to find the file by typing
58*4882a593Smuzhiyunthis once:
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun    git config sendemail.aliasesfile doc/git-mailrc
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunFor both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring
63*4882a593Smuzhiyunout where to send patches pretty well.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunDuring the first run patman creates a config file for you by taking the default
66*4882a593Smuzhiyunuser name and email address from the global .gitconfig file.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunTo add your own, create a file ~/.patman like this:
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun>>>>
71*4882a593Smuzhiyun# patman alias file
72*4882a593Smuzhiyun
73*4882a593Smuzhiyun[alias]
74*4882a593Smuzhiyunme: Simon Glass <sjg@chromium.org>
75*4882a593Smuzhiyun
76*4882a593Smuzhiyunu-boot: U-Boot Mailing List <u-boot@lists.denx.de>
77*4882a593Smuzhiyunwolfgang: Wolfgang Denk <wd@denx.de>
78*4882a593Smuzhiyunothers: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net>
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun<<<<
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunAliases are recursive.
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunThe checkpatch.pl in the U-Boot tools/ subdirectory will be located and
85*4882a593Smuzhiyunused. Failing that you can put it into your path or ~/bin/checkpatch.pl
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunIf you want to avoid sending patches to email addresses that are picked up
88*4882a593Smuzhiyunby patman but are known to bounce you can add a [bounces] section to your
89*4882a593Smuzhiyun.patman file. Unlike the [alias] section these are simple key: value pairs
90*4882a593Smuzhiyunthat are not recursive.
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun>>>
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun[bounces]
95*4882a593Smuzhiyungonefishing: Fred Bloggs <f.bloggs@napier.net>
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun<<<
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunIf you want to change the defaults for patman's command-line arguments,
101*4882a593Smuzhiyunyou can add a [settings] section to your .patman file.  This can be used
102*4882a593Smuzhiyunfor any command line option by referring to the "dest" for the option in
103*4882a593Smuzhiyunpatman.py.  For reference, the useful ones (at the moment) shown below
104*4882a593Smuzhiyun(all with the non-default setting):
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun>>>
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun[settings]
109*4882a593Smuzhiyunignore_errors: True
110*4882a593Smuzhiyunprocess_tags: False
111*4882a593Smuzhiyunverbose: True
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun<<<
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunIf you want to adjust settings (or aliases) that affect just a single
117*4882a593Smuzhiyunproject you can add a section that looks like [project_settings] or
118*4882a593Smuzhiyun[project_alias].  If you want to use tags for your linux work, you could
119*4882a593Smuzhiyundo:
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun>>>
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun[linux_settings]
124*4882a593Smuzhiyunprocess_tags: True
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun<<<
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun
129*4882a593SmuzhiyunHow to run it
130*4882a593Smuzhiyun=============
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunFirst do a dry run:
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun$ ./tools/patman/patman -n
135*4882a593Smuzhiyun
136*4882a593SmuzhiyunIf it can't detect the upstream branch, try telling it how many patches
137*4882a593Smuzhiyunthere are in your series:
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun$ ./tools/patman/patman -n -c5
140*4882a593Smuzhiyun
141*4882a593SmuzhiyunThis will create patch files in your current directory and tell you who
142*4882a593Smuzhiyunit is thinking of sending them to. Take a look at the patch files.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun$ ./tools/patman/patman -n -c5 -s1
145*4882a593Smuzhiyun
146*4882a593SmuzhiyunSimilar to the above, but skip the first commit and take the next 5. This
147*4882a593Smuzhiyunis useful if your top commit is for setting up testing.
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun
150*4882a593SmuzhiyunHow to install it
151*4882a593Smuzhiyun=================
152*4882a593Smuzhiyun
153*4882a593SmuzhiyunThe most up to date version of patman can be found in the U-Boot sources.
154*4882a593SmuzhiyunHowever to use it on other projects it may be more convenient to install it as
155*4882a593Smuzhiyuna standalone application. A distutils installer is included, this can be used
156*4882a593Smuzhiyunto install patman:
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun$ cd tools/patman && python setup.py install
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun
161*4882a593SmuzhiyunHow to add tags
162*4882a593Smuzhiyun===============
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunTo make this script useful you must add tags like the following into any
165*4882a593Smuzhiyuncommit. Most can only appear once in the whole series.
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunSeries-to: email / alias
168*4882a593Smuzhiyun	Email address / alias to send patch series to (you can add this
169*4882a593Smuzhiyun	multiple times)
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunSeries-cc: email / alias, ...
172*4882a593Smuzhiyun	Email address / alias to Cc patch series to (you can add this
173*4882a593Smuzhiyun	multiple times)
174*4882a593Smuzhiyun
175*4882a593SmuzhiyunSeries-version: n
176*4882a593Smuzhiyun	Sets the version number of this patch series
177*4882a593Smuzhiyun
178*4882a593SmuzhiyunSeries-prefix: prefix
179*4882a593Smuzhiyun	Sets the subject prefix. Normally empty but it can be RFC for
180*4882a593Smuzhiyun	RFC patches, or RESEND if you are being ignored. The patch subject
181*4882a593Smuzhiyun	is like [RFC PATCH] or [RESEND PATCH].
182*4882a593Smuzhiyun	In the meantime, git format.subjectprefix option will be added as
183*4882a593Smuzhiyun	well. If your format.subjectprefix is set to InternalProject, then
184*4882a593Smuzhiyun	the patch shows like: [InternalProject][RFC/RESEND PATCH]
185*4882a593Smuzhiyun
186*4882a593SmuzhiyunSeries-name: name
187*4882a593Smuzhiyun	Sets the name of the series. You don't need to have a name, and
188*4882a593Smuzhiyun	patman does not yet use it, but it is convenient to put the branch
189*4882a593Smuzhiyun	name here to help you keep track of multiple upstreaming efforts.
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunCover-letter:
192*4882a593SmuzhiyunThis is the patch set title
193*4882a593Smuzhiyunblah blah
194*4882a593Smuzhiyunmore blah blah
195*4882a593SmuzhiyunEND
196*4882a593Smuzhiyun	Sets the cover letter contents for the series. The first line
197*4882a593Smuzhiyun	will become the subject of the cover letter
198*4882a593Smuzhiyun
199*4882a593SmuzhiyunCover-letter-cc: email / alias
200*4882a593Smuzhiyun	Additional email addresses / aliases to send cover letter to (you
201*4882a593Smuzhiyun	can add this multiple times)
202*4882a593Smuzhiyun
203*4882a593SmuzhiyunSeries-notes:
204*4882a593Smuzhiyunblah blah
205*4882a593Smuzhiyunblah blah
206*4882a593Smuzhiyunmore blah blah
207*4882a593SmuzhiyunEND
208*4882a593Smuzhiyun	Sets some notes for the patch series, which you don't want in
209*4882a593Smuzhiyun	the commit messages, but do want to send, The notes are joined
210*4882a593Smuzhiyun	together and put after the cover letter. Can appear multiple
211*4882a593Smuzhiyun	times.
212*4882a593Smuzhiyun
213*4882a593SmuzhiyunCommit-notes:
214*4882a593Smuzhiyunblah blah
215*4882a593Smuzhiyunblah blah
216*4882a593Smuzhiyunmore blah blah
217*4882a593SmuzhiyunEND
218*4882a593Smuzhiyun	Similar, but for a single commit (patch). These notes will appear
219*4882a593Smuzhiyun	immediately below the --- cut in the patch file.
220*4882a593Smuzhiyun
221*4882a593Smuzhiyun Signed-off-by: Their Name <email>
222*4882a593Smuzhiyun	A sign-off is added automatically to your patches (this is
223*4882a593Smuzhiyun	probably a bug). If you put this tag in your patches, it will
224*4882a593Smuzhiyun	override the default signoff that patman automatically adds.
225*4882a593Smuzhiyun	Multiple duplicate signoffs will be removed.
226*4882a593Smuzhiyun
227*4882a593Smuzhiyun Tested-by: Their Name <email>
228*4882a593Smuzhiyun Reviewed-by: Their Name <email>
229*4882a593Smuzhiyun Acked-by: Their Name <email>
230*4882a593Smuzhiyun	These indicate that someone has tested/reviewed/acked your patch.
231*4882a593Smuzhiyun	When you get this reply on the mailing list, you can add this
232*4882a593Smuzhiyun	tag to the relevant commit and the script will include it when
233*4882a593Smuzhiyun	you send out the next version. If 'Tested-by:' is set to
234*4882a593Smuzhiyun	yourself, it will be removed. No one will believe you.
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunSeries-changes: n
237*4882a593Smuzhiyun- Guinea pig moved into its cage
238*4882a593Smuzhiyun- Other changes ending with a blank line
239*4882a593Smuzhiyun<blank line>
240*4882a593Smuzhiyun	This can appear in any commit. It lists the changes for a
241*4882a593Smuzhiyun	particular version n of that commit. The change list is
242*4882a593Smuzhiyun	created based on this information. Each commit gets its own
243*4882a593Smuzhiyun	change list and also the whole thing is repeated in the cover
244*4882a593Smuzhiyun	letter (where duplicate change lines are merged).
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun	By adding your change lists into your commits it is easier to
247*4882a593Smuzhiyun	keep track of what happened. When you amend a commit, remember
248*4882a593Smuzhiyun	to update the log there and then, knowing that the script will
249*4882a593Smuzhiyun	do the rest.
250*4882a593Smuzhiyun
251*4882a593SmuzhiyunPatch-cc: Their Name <email>
252*4882a593Smuzhiyun	This copies a single patch to another email address. Note that the
253*4882a593Smuzhiyun	Cc: used by git send-email is ignored by patman, but will be
254*4882a593Smuzhiyun	interpreted by git send-email if you use it.
255*4882a593Smuzhiyun
256*4882a593SmuzhiyunSeries-process-log: sort, uniq
257*4882a593Smuzhiyun	This tells patman to sort and/or uniq the change logs. It is
258*4882a593Smuzhiyun	assumed that each change log entry is only a single line long.
259*4882a593Smuzhiyun	Use 'sort' to sort the entries, and 'uniq' to include only
260*4882a593Smuzhiyun	unique entries. If omitted, no change log processing is done.
261*4882a593Smuzhiyun	Separate each tag with a comma.
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunVarious other tags are silently removed, like these Chrome OS and
264*4882a593SmuzhiyunGerrit tags:
265*4882a593Smuzhiyun
266*4882a593SmuzhiyunBUG=...
267*4882a593SmuzhiyunTEST=...
268*4882a593SmuzhiyunChange-Id:
269*4882a593SmuzhiyunReview URL:
270*4882a593SmuzhiyunReviewed-on:
271*4882a593SmuzhiyunCommit-xxxx: (except Commit-notes)
272*4882a593Smuzhiyun
273*4882a593SmuzhiyunExercise for the reader: Try adding some tags to one of your current
274*4882a593Smuzhiyunpatch series and see how the patches turn out.
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun
277*4882a593SmuzhiyunWhere Patches Are Sent
278*4882a593Smuzhiyun======================
279*4882a593Smuzhiyun
280*4882a593SmuzhiyunOnce the patches are created, patman sends them using git send-email. The
281*4882a593Smuzhiyunwhole series is sent to the recipients in Series-to: and Series-cc.
282*4882a593SmuzhiyunYou can Cc individual patches to other people with the Patch-cc: tag. Tags
283*4882a593Smuzhiyunin the subject are also picked up to Cc patches. For example, a commit like
284*4882a593Smuzhiyunthis:
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun>>>>
287*4882a593Smuzhiyuncommit 10212537b85ff9b6e09c82045127522c0f0db981
288*4882a593SmuzhiyunAuthor: Mike Frysinger <vapier@gentoo.org>
289*4882a593SmuzhiyunDate:	Mon Nov 7 23:18:44 2011 -0500
290*4882a593Smuzhiyun
291*4882a593Smuzhiyun    x86: arm: add a git mailrc file for maintainers
292*4882a593Smuzhiyun
293*4882a593Smuzhiyun    This should make sending out e-mails to the right people easier.
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun    Patch-cc: sandbox, mikef, ag
296*4882a593Smuzhiyun    Patch-cc: afleming
297*4882a593Smuzhiyun<<<<
298*4882a593Smuzhiyun
299*4882a593Smuzhiyunwill create a patch which is copied to x86, arm, sandbox, mikef, ag and
300*4882a593Smuzhiyunafleming.
301*4882a593Smuzhiyun
302*4882a593SmuzhiyunIf you have a cover letter it will get sent to the union of the Patch-cc
303*4882a593Smuzhiyunlists of all of the other patches. If you want to sent it to additional
304*4882a593Smuzhiyunpeople you can add a tag:
305*4882a593Smuzhiyun
306*4882a593SmuzhiyunCover-letter-cc: <list of addresses>
307*4882a593Smuzhiyun
308*4882a593SmuzhiyunThese people will get the cover letter even if they are not on the To/Cc
309*4882a593Smuzhiyunlist for any of the patches.
310*4882a593Smuzhiyun
311*4882a593Smuzhiyun
312*4882a593SmuzhiyunExample Work Flow
313*4882a593Smuzhiyun=================
314*4882a593Smuzhiyun
315*4882a593SmuzhiyunThe basic workflow is to create your commits, add some tags to the top
316*4882a593Smuzhiyuncommit, and type 'patman' to check and send them.
317*4882a593Smuzhiyun
318*4882a593SmuzhiyunHere is an example workflow for a series of 4 patches. Let's say you have
319*4882a593Smuzhiyunthese rather contrived patches in the following order in branch us-cmd in
320*4882a593Smuzhiyunyour tree where 'us' means your upstreaming activity (newest to oldest as
321*4882a593Smuzhiyunoutput by git log --oneline):
322*4882a593Smuzhiyun
323*4882a593Smuzhiyun    7c7909c wip
324*4882a593Smuzhiyun    89234f5 Don't include standard parser if hush is used
325*4882a593Smuzhiyun    8d640a7 mmc: sparc: Stop using builtin_run_command()
326*4882a593Smuzhiyun    0c859a9 Rename run_command2() to run_command()
327*4882a593Smuzhiyun    a74443f sandbox: Rename run_command() to builtin_run_command()
328*4882a593Smuzhiyun
329*4882a593SmuzhiyunThe first patch is some test things that enable your code to be compiled,
330*4882a593Smuzhiyunbut that you don't want to submit because there is an existing patch for it
331*4882a593Smuzhiyunon the list. So you can tell patman to create and check some patches
332*4882a593Smuzhiyun(skipping the first patch) with:
333*4882a593Smuzhiyun
334*4882a593Smuzhiyun    patman -s1 -n
335*4882a593Smuzhiyun
336*4882a593SmuzhiyunIf you want to do all of them including the work-in-progress one, then
337*4882a593Smuzhiyun(if you are tracking an upstream branch):
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun    patman -n
340*4882a593Smuzhiyun
341*4882a593SmuzhiyunLet's say that patman reports an error in the second patch. Then:
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun    git rebase -i HEAD~6
344*4882a593Smuzhiyun    <change 'pick' to 'edit' in 89234f5>
345*4882a593Smuzhiyun    <use editor to make code changes>
346*4882a593Smuzhiyun    git add -u
347*4882a593Smuzhiyun    git rebase --continue
348*4882a593Smuzhiyun
349*4882a593SmuzhiyunNow you have an updated patch series. To check it:
350*4882a593Smuzhiyun
351*4882a593Smuzhiyun    patman -s1 -n
352*4882a593Smuzhiyun
353*4882a593SmuzhiyunLet's say it is now clean and you want to send it. Now you need to set up
354*4882a593Smuzhiyunthe destination. So amend the top commit with:
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun    git commit --amend
357*4882a593Smuzhiyun
358*4882a593SmuzhiyunUse your editor to add some tags, so that the whole commit message is:
359*4882a593Smuzhiyun
360*4882a593Smuzhiyun    The current run_command() is really only one of the options, with
361*4882a593Smuzhiyun    hush providing the other. It really shouldn't be called directly
362*4882a593Smuzhiyun    in case the hush parser is bring used, so rename this function to
363*4882a593Smuzhiyun    better explain its purpose.
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun    Series-to: u-boot
366*4882a593Smuzhiyun    Series-cc: bfin, marex
367*4882a593Smuzhiyun    Series-prefix: RFC
368*4882a593Smuzhiyun    Cover-letter:
369*4882a593Smuzhiyun    Unified command execution in one place
370*4882a593Smuzhiyun
371*4882a593Smuzhiyun    At present two parsers have similar code to execute commands. Also
372*4882a593Smuzhiyun    cmd_usage() is called all over the place. This series adds a single
373*4882a593Smuzhiyun    function which processes commands called cmd_process().
374*4882a593Smuzhiyun    END
375*4882a593Smuzhiyun
376*4882a593Smuzhiyun    Change-Id: Ica71a14c1f0ecb5650f771a32fecb8d2eb9d8a17
377*4882a593Smuzhiyun
378*4882a593Smuzhiyun
379*4882a593SmuzhiyunYou want this to be an RFC and Cc the whole series to the bfin alias and
380*4882a593Smuzhiyunto Marek. Two of the patches have tags (those are the bits at the front of
381*4882a593Smuzhiyunthe subject that say mmc: sparc: and sandbox:), so 8d640a7 will be Cc'd to
382*4882a593Smuzhiyunmmc and sparc, and the last one to sandbox.
383*4882a593Smuzhiyun
384*4882a593SmuzhiyunNow to send the patches, take off the -n flag:
385*4882a593Smuzhiyun
386*4882a593Smuzhiyun   patman -s1
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunThe patches will be created, shown in your editor, and then sent along with
389*4882a593Smuzhiyunthe cover letter. Note that patman's tags are automatically removed so that
390*4882a593Smuzhiyunpeople on the list don't see your secret info.
391*4882a593Smuzhiyun
392*4882a593SmuzhiyunOf course patches often attract comments and you need to make some updates.
393*4882a593SmuzhiyunLet's say one person sent comments and you get an Acked-by: on one patch.
394*4882a593SmuzhiyunAlso, the patch on the list that you were waiting for has been merged,
395*4882a593Smuzhiyunso you can drop your wip commit. So you resync with upstream:
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun    git fetch origin		(or whatever upstream is called)
398*4882a593Smuzhiyun    git rebase origin/master
399*4882a593Smuzhiyun
400*4882a593Smuzhiyunand use git rebase -i to edit the commits, dropping the wip one. You add
401*4882a593Smuzhiyunthe ack tag to one commit:
402*4882a593Smuzhiyun
403*4882a593Smuzhiyun    Acked-by: Heiko Schocher <hs@denx.de>
404*4882a593Smuzhiyun
405*4882a593Smuzhiyunupdate the Series-cc: in the top commit:
406*4882a593Smuzhiyun
407*4882a593Smuzhiyun    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
408*4882a593Smuzhiyun
409*4882a593Smuzhiyunand remove the Series-prefix: tag since it it isn't an RFC any more. The
410*4882a593Smuzhiyunseries is now version two, so the series info in the top commit looks like
411*4882a593Smuzhiyunthis:
412*4882a593Smuzhiyun
413*4882a593Smuzhiyun    Series-to: u-boot
414*4882a593Smuzhiyun    Series-cc: bfin, marex, Heiko Schocher <hs@denx.de>
415*4882a593Smuzhiyun    Series-version: 2
416*4882a593Smuzhiyun    Cover-letter:
417*4882a593Smuzhiyun    ...
418*4882a593Smuzhiyun
419*4882a593SmuzhiyunFinally, you need to add a change log to the two commits you changed. You
420*4882a593Smuzhiyunadd change logs to each individual commit where the changes happened, like
421*4882a593Smuzhiyunthis:
422*4882a593Smuzhiyun
423*4882a593Smuzhiyun    Series-changes: 2
424*4882a593Smuzhiyun    - Updated the command decoder to reduce code size
425*4882a593Smuzhiyun    - Wound the torque propounder up a little more
426*4882a593Smuzhiyun
427*4882a593Smuzhiyun(note the blank line at the end of the list)
428*4882a593Smuzhiyun
429*4882a593SmuzhiyunWhen you run patman it will collect all the change logs from the different
430*4882a593Smuzhiyuncommits and combine them into the cover letter, if you have one. So finally
431*4882a593Smuzhiyunyou have a new series of commits:
432*4882a593Smuzhiyun
433*4882a593Smuzhiyun    faeb973 Don't include standard parser if hush is used
434*4882a593Smuzhiyun    1b2f2fe mmc: sparc: Stop using builtin_run_command()
435*4882a593Smuzhiyun    cfbe330 Rename run_command2() to run_command()
436*4882a593Smuzhiyun    0682677 sandbox: Rename run_command() to builtin_run_command()
437*4882a593Smuzhiyun
438*4882a593Smuzhiyunso to send them:
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun    patman
441*4882a593Smuzhiyun
442*4882a593Smuzhiyunand it will create and send the version 2 series.
443*4882a593Smuzhiyun
444*4882a593SmuzhiyunGeneral points:
445*4882a593Smuzhiyun
446*4882a593Smuzhiyun1. When you change back to the us-cmd branch days or weeks later all your
447*4882a593Smuzhiyuninformation is still there, safely stored in the commits. You don't need
448*4882a593Smuzhiyunto remember what version you are up to, who you sent the last lot of patches
449*4882a593Smuzhiyunto, or anything about the change logs.
450*4882a593Smuzhiyun
451*4882a593Smuzhiyun2. If you put tags in the subject, patman will Cc the maintainers
452*4882a593Smuzhiyunautomatically in many cases.
453*4882a593Smuzhiyun
454*4882a593Smuzhiyun3. If you want to keep the commits from each series you sent so that you can
455*4882a593Smuzhiyuncompare change and see what you did, you can either create a new branch for
456*4882a593Smuzhiyuneach version, or just tag the branch before you start changing it:
457*4882a593Smuzhiyun
458*4882a593Smuzhiyun    git tag sent/us-cmd-rfc
459*4882a593Smuzhiyun    ...later...
460*4882a593Smuzhiyun    git tag sent/us-cmd-v2
461*4882a593Smuzhiyun
462*4882a593Smuzhiyun4. If you want to modify the patches a little before sending, you can do
463*4882a593Smuzhiyunthis in your editor, but be careful!
464*4882a593Smuzhiyun
465*4882a593Smuzhiyun5. If you want to run git send-email yourself, use the -n flag which will
466*4882a593Smuzhiyunprint out the command line patman would have used.
467*4882a593Smuzhiyun
468*4882a593Smuzhiyun6. It is a good idea to add the change log info as you change the commit,
469*4882a593Smuzhiyunnot later when you can't remember which patch you changed. You can always
470*4882a593Smuzhiyungo back and change or remove logs from commits.
471*4882a593Smuzhiyun
472*4882a593Smuzhiyun
473*4882a593SmuzhiyunOther thoughts
474*4882a593Smuzhiyun==============
475*4882a593Smuzhiyun
476*4882a593SmuzhiyunThis script has been split into sensible files but still needs work.
477*4882a593SmuzhiyunMost of these are indicated by a TODO in the code.
478*4882a593Smuzhiyun
479*4882a593SmuzhiyunIt would be nice if this could handle the In-reply-to side of things.
480*4882a593Smuzhiyun
481*4882a593SmuzhiyunThe tests are incomplete, as is customary. Use the --test flag to run them,
482*4882a593Smuzhiyunand make sure you are in the tools/patman directory first:
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun    $ cd /path/to/u-boot
485*4882a593Smuzhiyun    $ cd tools/patman
486*4882a593Smuzhiyun    $ ./patman --test
487*4882a593Smuzhiyun
488*4882a593SmuzhiyunError handling doesn't always produce friendly error messages - e.g.
489*4882a593Smuzhiyunputting an incorrect tag in a commit may provide a confusing message.
490*4882a593Smuzhiyun
491*4882a593SmuzhiyunThere might be a few other features not mentioned in this README. They
492*4882a593Smuzhiyunmight be bugs. In particular, tags are case sensitive which is probably
493*4882a593Smuzhiyuna bad thing.
494*4882a593Smuzhiyun
495*4882a593Smuzhiyun
496*4882a593SmuzhiyunSimon Glass <sjg@chromium.org>
497*4882a593Smuzhiyunv1, v2, 19-Oct-11
498*4882a593Smuzhiyunrevised v3 24-Nov-11
499