summaryrefslogtreecommitdiffstats
path: root/tools/patman/patchstream.py
Commit message (Collapse)AuthorAgeFilesLines
* patman: Continue on if warnings are found outside a commitSimon Glass2021-04-061-2/+2
| | | | | | | While we cannot know which commit the warning relates to, this should not be fatal. Print the warning and carry on. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Correct Change-Ids error message argsSimon Glass2020-11-141-2/+2
| | | | | | The arguments of this error are incorrectly formatted. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Support listing comments from patchworkSimon Glass2020-11-051-3/+4
| | | | | | | | | | While reviewing feedback it is helpful to see the review comments on the command line to check that each has been addressed. Add an option to support that. Update the workflow documentation to describe the new features. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Support parsing of review snippetsSimon Glass2020-11-051-0/+85
| | | | | | | | | | | | | | | Add support for parsing the contents of a patchwork 'patch' web page containing comments received from reviewers. This allows patman to show these comments in a simple 'snippets' format. A snippet is some quoted code plus some unquoted comments below it. Each review is from a unique person/email and can produce multiple snippets, one for each part of the code that attracts a comment. Show the file and line-number info at the top of each snippet if available. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Support updating a branch with review tagsSimon Glass2020-11-051-3/+49
| | | | | | | | It is tedious to add review tags into the local branch and errors can sometimes be made. Add an option to create a new branch with the review tags obtained from patchwork. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Fix spelling of plural for warningSimon Glass2020-11-051-4/+5
| | | | | | | Tidy up the extra 's' when there is only a single warning. Fix the empty print statement also. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Add some tests for warningsSimon Glass2020-11-051-1/+1
| | | | | | Add tests that check that warnings are generated when expected. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Add a test for PatchStream tagsSimon Glass2020-11-051-0/+23
| | | | | | | The current functional tests run most of patman. Add a smaller test that just checks tag handling with the PatchStream class. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Drop unused signoff memberSimon Glass2020-11-051-1/+0
| | | | | | This is not used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Convert 'Series-xxx' tag errors into warningsSimon Glass2020-11-051-1/+3
| | | | | | | | | | | If the Series-xxx tag is not recognised patman currently reports a fatal error. This is inconvenient if a new feature is later added to patman that an earlier version does not support. Report a warning instead, to allow the user to take action if needed, but still allow operation to proceed. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Attach warnings to individual patchesSimon Glass2020-11-051-4/+11
| | | | | | | | | | | At present warnings are produced across the whole set of patches when parsing them. It is more useful to associate each warning with the patch (or commit) that generated it. Attach warnings to the Commit object and move them out of PatchStream. Also avoid generating duplicate warnings for the same commit. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Move warning collection to a functionSimon Glass2020-11-051-13/+23
| | | | | | | | | | | Add a new function in PatchStream to collect the warnings generated while parsing the stream. This will allow us to adjust the logic, such as dealing with per-commit warnings. Two of the warnings are in fact internal errors, so change them to raise and exception. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Fix up argument/return docs in patchstreamSimon Glass2020-11-051-32/+50
| | | | | | | Add missing documentation and type information. Fix up some missing docs on exceptions also. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Drop unused args in patchstreamSimon Glass2020-11-051-5/+3
| | | | | | Drop a few arguments that are not used in functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Rename variables in patchstreamSimon Glass2020-11-051-26/+26
| | | | | | | Some variables are too short or shadow other variables or types. Fix these to keep pylint3 happy. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Rename functions in patchstreamSimon Glass2020-11-051-44/+44
| | | | | | Rename these functions to lower case as per PEP8. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Fix constant style in patchstreamSimon Glass2020-11-051-22/+22
| | | | | | These constants should use upper case. Update them to keep pylint3 happy. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Fix indenting in patchstreamSimon Glass2020-11-051-13/+16
| | | | | | Update the indenting to keep pylint3 happy. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add information for skipped commit optionsPatrick Delaunay2020-07-251-0/+3
| | | | | | | | | | | | | | | | | The unsupported Commit-xxx option are silently skipped and removed as 're_remove=Commit-\w*', this patch adds warning message in this case to detect misspelled issue for the 2 supported options: Commit-notes: Commit-changes: For example: the final 's' is missing (Commit-note:) NB: no issue for Series-xxx option as only the supported options are accepted (see valid_series in series.py) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Detect unexpected ENDPatrick Delaunay2020-07-251-0/+4
| | | | | | | | | | | | | | | | | Detect unexpected 'END' line when a section is not detected. This patch detect issue when tag name for section start is misspelled, for example 'Commit-note:' for 'Commit-notes:' Commit-note: .... END Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:" but 'END' is kept in commit message. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Support collecting response tags in PatchstreamSimon Glass2020-07-241-5/+16
| | | | | | | | | Collect response tags such as 'Reviewed-by' while parsing the stream. This allows us to see what tags are present. Add a new 'Fixes' tag also, since this is now quite common. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Allow creating patches for another branchSimon Glass2020-07-241-3/+5
| | | | | | | Add a -b option to allow patches to be created from a branch other than the current one. Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"Tom Rini2020-07-241-28/+8
| | | | | | | | | | This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing changes made to 56d37f1c564107e27d873181d838571b7d7860e7. Unfortunately this is causing CI failures: https://travis-ci.org/github/trini/u-boot/jobs/711313649 Signed-off-by: Tom Rini <trini@konsulko.com>
* Add information for skipped commit optionsPatrick Delaunay2020-07-201-0/+3
| | | | | | | | | | | | | | | | | The unsupported Commit-xxx option are silently skipped and removed as 're_remove=Commit-\w*', this patch adds warning message in this case to detect misspelled issue for the 2 supported options: Commit-notes: Commit-changes: For example: the final 's' is missing (Commit-note:) NB: no issue for Series-xxx option as only the supported options are accepted (see valid_series in series.py) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Detect unexpected ENDPatrick Delaunay2020-07-201-0/+4
| | | | | | | | | | | | | | | | | Detect unexpected 'END' line when a section is not detected. This patch detect issue when tag name for section start is misspelled, for example 'Commit-note:' for 'Commit-notes:' Commit-note: .... END Then 'Commit-note:' is removed silently by re_remove = "Commit-\w*:" but 'END' is kept in commit message. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Support collecting response tags in PatchstreamSimon Glass2020-07-201-5/+16
| | | | | | | | | Collect response tags such as 'Reviewed-by' while parsing the stream. This allows us to see what tags are present. Add a new 'Fixes' tag also, since this is now quite common. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Allow creating patches for another branchSimon Glass2020-07-201-3/+5
| | | | | | | Add a -b option to allow patches to be created from a branch other than the current one. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Support multi-line changes in changelogsSean Anderson2020-05-291-8/+27
| | | | | | | | | | | | | This patch adds support to multi-line changes. That is, if one has a line in a changelog like - Do a thing but it spans multiple lines Using Series-process-log sort would sort as if those lines were unrelated. With this patch, any change line starting with whitespace will be considered part of the change before it. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Add new tags for finer-grained changelog controlSean Anderson2020-05-291-29/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default patman generates a combined changelog for the cover letter. This may not always be desirable. Many patches may have the same changes. These can be coalesced with "Series-process-log: uniq", but this is imperfect. Similar changes like "Move foo to patch 7" will not be merged with the similar "Move foo to this patch from patch 6". Changes may not make sense outside of the patch they are written for. For example, a change line of "Add check for bar" does not make sense outside of the context in which bar might be checked for. Some changes like "New" or "Lint" may be repeated many times throughout different change logs, but carry no useful information in a summary. Lastly, I like to summarize the broad strokes of the changes I have made in the cover letter, while documenting all the details in the appropriate patches. I think this makes it easier to get a good feel for what has changed, without making it difficult to wade through every change in the whole series. This patch adds two new tags to add changelog entries which only appear in the cover letter, or only appear in the commit. Changes documented with "Commit-changes" will only appear in the commit, and will not appear in the cover letter. Changes documented with "Cover-changes" will not appear in any commit, and will only appear in the cover letter. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Move to absolute importsSimon Glass2020-04-261-4/+4
| | | | | | | | | | | At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use unicode for file I/OSimon Glass2019-11-041-2/+2
| | | | | | | At present patman test fail in some environments which don't use utf-8 as the default file encoding. Add this explicitly. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use the Change-Id, version, and prefix in the Message-IdDouglas Anderson2019-10-151-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per the centithread on ksummit-discuss [1], there are folks who feel that if a Change-Id is present in a developer's local commit that said Change-Id could be interesting to include in upstream posts. Specifically if two commits are posted with the same Change-Id there's a reasonable chance that they are either the same commit or a newer version of the same commit. Specifically this is because that's how gerrit has trained people to work. There is much angst about Change-Id in upstream Linux, but one thing that seems safe and non-controversial is to include the Change-Id as part of the string of crud that makes up a Message-Id. Let's give that a try. In theory (if there is enough adoption) this could help a tool more reliably find various versions of a commit. This actually might work pretty well for U-Boot where (I believe) quite a number of developers use patman, so there could be critical mass (assuming that enough of these people also use a git hook that adds Change-Id to their commits). I was able to find this git hook by searching for "gerrit change id git hook" in my favorite search engine. In theory one could imagine something like this could be integrated into other tools, possibly even git-send-email. Getting it into patman seems like a sane first step, though. NOTE: this patch is being posted using a patman containing this patch, so you should be able to see the Message-Id of this patch and see that it contains my local Change-Id, which ends in 2b9 if you want to check. [1] https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2019-August/006739.html Signed-off-by: Douglas Anderson <dianders@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* patman: Add a functional testSimon Glass2017-06-081-0/+13
| | | | | | | | | | | | | | The existing test (patman --test) only covers basic checkpatch output. We have had some problems with unicode processing and could use test coverage for the various tags patman supports. Add a new functional test which runs most of the patman flow on a few test commits and checks that the results are correct. See the documentation in the test for a description of what it does. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* patman: Don't return the series in FixPatches()Simon Glass2017-06-081-1/+0
| | | | | | | | There is no need for this function to return the same object that was passed in. Drop the return value. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* patman: Don't report unicode characterSimon Glass2017-06-081-9/+0
| | | | | | | | Unicode characters may appear in input patches so we should not warn about them. Drop this warning. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* patman: Make print statements python 3.x safePaul Burton2016-10-091-3/+3
| | | | | | | | | 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>
* tools: patman: Handle missing 'END' in non-last commit of a seriesBin Meng2016-07-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* tools: patman: Handle missing blank line for 'Series-changes'Bin Meng2016-07-111-2/+8
| | | | | | | | | '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>
* tools: patman: Generate cover letter correctly when 'END' is missingBin Meng2016-07-111-0/+8
| | | | | | | | | | 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>
* tools: patman: Handle tag sections without an 'END'Bin Meng2016-07-111-0/+20
| | | | | | | | | | | '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>
* tools: patman: Use cover_match for 'Cover-letter'Bin Meng2016-07-111-1/+2
| | | | | | | | 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>
* patman: Add a missing space in GetMetaDataForList()Simon Glass2016-03-141-1/+1
| | | | | | | Fix this nit to keep the code consistent. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* patman: cover letter shows like 00/xx if more than 10 patchesWu, Josh2015-04-181-2/+5
| | | | | | | 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>
* patman: Check commit_match before stripping leading whitespaceScott Wood2015-01-301-1/+3
| | | | | | | | | | | | | 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>
* patman: Use the full commit hash for 'git checkout'Simon Glass2014-11-261-2/+1
| | | | | | | 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>
* buildman: Ignore conflicting tagsSimon Glass2014-09-091-1/+3
| | | | | | | | | | | 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>
* patman: Start with a clean series when neededSimon Glass2014-09-091-1/+3
| | | | | | | | | | | 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>
* patman: Avoid changing the order of tagsSimon Glass2014-09-051-13/+1
| | | | | | | | | | 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>
* patman: Correct unit tests to run correctlySimon Glass2014-09-051-2/+5
| | | | | | | | | | 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>