summaryrefslogtreecommitdiff
path: root/tools/patman/patchstream.py
AgeCommit message (Collapse)Author
2016-10-09patman: Make print statements python 3.x safePaul Burton
In python 3.x, print must be used as a function call. Convert all print statements to the function call style, importing from __future__ where we print with no trailing newline or print to a file object. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-11tools: patman: Handle missing 'END' in non-last commit of a seriesBin Meng
The following python error: Traceback (most recent call last): File "./tools/patman/patman", line 144, in <module> series = patchstream.FixPatches(series, args) File "./tools/patman/patchstream.py", line 477, in FixPatches commit = series.commits[count] IndexError: list index out of range is seen when: - 'END' is missing in those tags - those tags are put in the last part in a commit message - the commit is not the last commit of the series Add testing logic to see if a new commit starts. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-11tools: patman: Handle missing blank line for 'Series-changes'Bin Meng
'Series-changes' uses blank line to indicate its end. If that is missing, series internal state variable 'in_change' may be wrong. Correct its state. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-11tools: patman: Generate cover letter correctly when 'END' is missingBin Meng
If 'END' is missing in a 'Cover-letter' section, and that section happens to show up at the very end of the commit message, and the commit is the last commit of the series, patman fails to generate cover letter for us. Handle this in CloseCommit of patchstream. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-11tools: patman: Handle tag sections without an 'END'Bin Meng
'Cover-letter', 'Series-notes' and 'Commit-notes' tags require an 'END' to be put at the end of its section. If we forget to put an 'END' in those sections, and these sections are followed by another patman tag, patman generates incorrect patches. This adds codes to handle such scenario. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-11tools: patman: Use cover_match for 'Cover-letter'Bin Meng
Like other patman tags, use a new variable cover_match to indicate a match for 'Cover-letter'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-03-14patman: Add a missing space in GetMetaDataForList()Simon Glass
Fix this nit to keep the code consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-04-18patman: cover letter shows like 00/xx if more than 10 patchesWu, Josh
Make cover letter shows like 0/x, 00/xx and 000/xxx etc. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-01-30patman: Check commit_match before stripping leading whitespaceScott Wood
True commit lines start at column zero. Anything that is indented is part of the commit message instead. I noticed this by trying to run buildman with commit e3a4facdfc07179ebe017a07b8de6224a935a9f3 as master, which contained a reference to a Linux commit inside the commit message. ProcessLine saw that as a genuite commit line, and thus buildman tried to build it, and died with an exception because that SHA is not present in the U-Boot tree. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-11-26patman: Use the full commit hash for 'git checkout'Simon Glass
Even with the initial 8 characeters of the hash we will sometimes get a collision. Use the full hash. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-09-09buildman: Ignore conflicting tagsSimon Glass
Tags like Series-version are normally expected to appear once, and with a unique value. But buildman doesn't actually look at these tags. So ignore conflicts. This allows bulidman to build a branch containing multiple patman series. Reported-by: Steve Rae <srae@broadcom.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-09-09patman: Start with a clean series when neededSimon Glass
For reasons that are not well-understood, GetMetaDataForList() can end up adding to an existing series even when it appears that it should be starting a new one. Change from using a default constructor parameter to an explicit one, to work around this problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-09-05patman: Avoid changing the order of tagsSimon Glass
patman collects tags that it sees in the commit and places them nicely sorted at the end of the patch. However, this is not really necessary and in fact is apparently not desirable. Suggested-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2014-09-05patman: Correct unit tests to run correctlySimon Glass
It seems that doctest behaves differently now, and some of the unit tests do not run. Adjust the tests to work correctly. ./tools/patman/patman --test <unittest.result.TestResult run=10 errors=0 failures=0> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-08-13patman: Move the 'git log' command into a functionSimon Glass
Move the code that builds a 'git log' command into a function so we can more easily adjust it. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-05-16patman: Suppress duplicate signoffs only for real patchesSimon Glass
There is an unfortunate bug in the signoff suppression logic. The first pass is performed with 'git log', and all signoffs are added to the supression set, such that the second time (when processing the real patches) we always suppress the signoffs. Correct this by only suppressing signoffs in the second pass. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <monstr@monstr.eu> Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
2014-05-09patman: Avoid duplicate sign-offsSimon Glass
Keep track of all Signed-off-by tags in a commit and silently suppress any duplicates. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-03-22patman: Use Patch-cc: instead of Cc:Simon Glass
Add a new Patch-cc: tag which performs the service now provided by the Cc: tag. The Cc: tag is interpreted by git send-email but ignored by patman. So now: Cc: patman does nothing. (git send-email can cc patches) Patch-cc: patman Cc's patch and removes this tag from the patch Signed-off-by: Simon Glass <sjg@chromium.org>
2013-11-21patman: add Commit-notes tag and sectionAlbert ARIBAUD
Sometimes a commit should have notes enclosed with it rather than withing the cover letter -- possibly even because there is no cover letter. Add a 'Commit-notes' tag, similar to the 'Series-notes' one; lines between this tag and the next END line are inserted in the patch right after the '---' commit delimiter. Change-Id: I01e99ae125607dc6dec08f3be8a5a0b37f0a483d Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net> Signed-off-by: Simon Glass <sjg@chromium.org> (Updated README)
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-04-18patman: fix gitutil for decorationsAndreas Bießmann
The git config parameter log.decorate is quite useful when working with git. Patman, however can not handle the decorated output when parsing the commit. To prevent this use the '--no-decorate' switch for git-log. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Simon Glass <sjg@chromium.org>
2013-04-08patman: Add Series-process-log tag to sort/uniq change logsSimon Glass
For some series with lots of changes it is annoying that duplicate change log items are not caught. It is also helpful sometimes to sort the change logs. Add a Series-process-log tag to enable this, which can be placed in a commit to control this. The change to the Cc: line is to fix a checkpatch warning. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-04-08patman: Don't barf if the word 'commit' starts a lineDoug Anderson
Patman's regular expression for detecting the start of a commit in a git log was a little simplistic and could be confused if the git log itself had the word "commit" as the start of a line (as this commit does). Make patman a little more robust. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2013-04-04patman: Ignore all Gerrit Commit-* tagsSimon Glass
These tags are used by Gerrit, so let's ignore all of them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-04-04patman: Add Cover-letter-cc tag to Cc cover letter to peopleSimon Glass
The cover letter is sent to everyone who is on the Cc list for any of the patches in the series. Sometimes it is useful to send just the cover letter to additional people, so that they are aware of the series, but don't need to wade through all the individual patches. Add a new Cover-letter-cc tag for this purpose. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org>
2013-04-04patman: Make "Reviewed-by" an important tagDoug Anderson
Although "Reviewed-by:" is a tag that gerrit adds, it's also a tag used by upstream. Stripping it is undesirable. In fact, we should treat it as important. Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br> Acked-by: Simon Glass <sjg@chromium.org>
2013-04-04patman: Allow reading metadata from a list of commitsSimon Glass
We normally read from the current branch, but buildman will need to look at commits from another branch. Allow the metadata to be read from any list of commits, to provide this flexibility. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-04-04patman: Make command methods return a CommandResultSimon Glass
Rather than returning a list of things, return an object. That makes it easier to access the returned items, and easier to extend the return value later. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-11-04patman: Add additional tags to ignoreSimon Glass
The BRANCH= tag can be used to indicate the destination branch for a commit. Ignore this tag. Also ignore the gerrit 'Commit-Ready:' tag. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-19patman: force git log commands to not use colorAlbert ARIBAUD
Colored logs confuse patman when analyzing logs. Add --no-color option in git log commands in case the default config has color. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@ti.com>
2012-09-02patman: don't mess with signoffsIlya Yanok
Currently patman assumes that there should be only one Signoff line and this is obviously incorrect: we often have to work with patches containing other people signoffs. Moreover, it's really desirable to preserve the comments between signoffs. So until some sophisticated signoff processing will be developed I suggest just don't mess with signoffs at all and treat them like plain text lines. The only drawback I've found so far is the case where you have a patch with someones else signoff but not yours and also have to patman tags under signoff line. In this case you will get extra empty line between signoffs. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-09-02patman: don't pick changes while processing patchesIlya Yanok
We already got all changes from git log output and the comment to the ProcessLine function clearly states that 'patch' mode is not for scanning tags. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-09-02patman: fix end of changes detectionIlya Yanok
Changes may end in '---' line or Signoff line (generated by git format-patch) in case of Series-changes: lines being the last ones in commit message. So detect it properly. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-04-21Add 'patman' patch generation, checking and submission scriptSimon Glass
What is this? ============= This tool is a Python script which: - Creates patch directly from your branch - Cleans them up by removing unwanted tags - Inserts a cover letter with change lists - Runs the patches through checkpatch.pl and its own checks - Optionally emails them out to selected people It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, since it uses the checkpatch.pl script. It is configured almost entirely by tags it finds in your commits. This means that you can work on a number of different branches at once, and keep the settings with each branch rather than having to git format-patch, git send-email, etc. with the correct parameters each time. So for example if you put: in one of your commits, the series will be sent there. See the README file for full details. END Signed-off-by: Simon Glass <sjg@chromium.org>