aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-06-21Remove stray print()Konstantin Ryabitsev
Yes, I debug with print(). Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-21Initial patchwork integration supportKonstantin Ryabitsev
A lot of maintainers use patchwork alongside b4, to make it easier to track patches and rely on some CI integration. This commit adds some basic patchwork integration: - on "b4 am", "b4 shazam", "b4 pr" we will mark the relevant patchwork entries as "Under Review" - on "b4 ty" we can set these patches as "Accepted" - on "b4 ty -d" we can set them as "Deferred" To make it work, the following entries must be present in the repository used with b4: [b4] pw-key = (your API token) pw-url = https://patchwork.kernel.org pw-project = (your project, e.g. linux-usb) pw-review-state = under-review pw-accept-state = accepted pw-discard-state = deferred To get your patchwork API token, go to your patchwork profile page. The pw-accept-state and pw-discard-state can be overridden using the --pw-set-state flag to "b4 ty". E.g. if you wanted to mark the patches as "Not applicable": b4 ty -d 5 --pw-set-state not-applicable Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-17Prepare for 0.9.0 releasev0.9.0Konstantin Ryabitsev
It is time to roll out 0.9.0 for wider use. Update requirements to the latest supported and tested versions. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-17Remove EXPERIMENTAL from attestation supportKonstantin Ryabitsev
We've been using patch attestation for over a year now, so remove the EXPERIMENTAL claim -- it's no more experimental by this point than the rest of b4. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-17Update patatt submodule to v0.5.0Konstantin Ryabitsev
Patatt-0.5.0 is out, so update our submodule info. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-17Add ability to exit before git-merge is invokedKonstantin Ryabitsev
It may be useful for the maintainer to review b4 retrieval/validation output before git-merge is invoked, so add a pause requiring an Enter or Ctrl-C. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-16Implement "b4 shazam -M" that execs git-mergeKonstantin Ryabitsev
In addition to just being able to fetch a series into FETCH_HEAD, also add an option to exec git-merge automatically so that people don't have to cut-and-paste the merge command to use with paths to the cover letter. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-16Add a note about proxying requestsKonstantin Ryabitsev
Proxying requests is possible via the HTTPS_PROXY env variable, so make a note of that in the manpage. Suggested-by: David Vernet <void@manifault.com> Link: https://lore.kernel.org/tools/20220218153128.914071-1-void@manifault.com Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-16Allow breaking threads using --no-parentKonstantin Ryabitsev
It is a common request to be able to get a partial thread in case someone submitted an auxiliary standalone patch in the middle of a larger patch series. Passing the msgid of the start of the thread along with --no-parent should tell b4 to break the thread at the start of the message-id specified and only consider that message and its children. Suggested-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/tools/YpTI9lhCfA7shi6j@sirena.org.uk/ Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-15Cosmetic cleanups to make PyCharm happierKonstantin Ryabitsev
Minor nitpicking by PyCharm, but not completely unreasonable. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-15Improve identity matching for DKIMKonstantin Ryabitsev
Sometimes the DKIM record will have the full email address instead of just the @domainname.com part. For those cases, drop the local part so we don't falsely claim domain mismatching during b4-am runs. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-14Lowercase identities for comparisonKonstantin Ryabitsev
When performing attestor identity comparisons, lowercase email addresses and domain names for case-insensitive matching. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-14am: Fix broken guessbranch handlingRob Herring
b4's usage of git-log '--branches' option is broken. The option takes a glob pattern *only* and must have an '=', but b4 ends up passing '--branches <guessbranch>' to git-log. This will kind of work, but is not checking only 'guessbranch'. For example, these 3 commands all do something different: git log -1 --branches=master git log -1 --branches master git log -1 --branches=*aster A maintainer wanting to apply a patch or series likely has a small set of known branches they apply patches to. Using a glob pattern is not a good fit for that. Instead, allow --guess-branch to be repeated and to take fixed refs. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://lore.kernel.org/r/20220331195346.1384515-1-robh@kernel.org
2022-06-14Remove unnecessary lookup when /all/ is used in midmaskKonstantin Ryabitsev
On lore.kernel.org we provide a unified index of all mailing lists in /all/, which removes the need to perform a redirect lookup when querying by message-id. However, some public-inbox instances may not have that, so we still need to be able to fall back to that redirect lookup. Adapt a patch from Rob Herring to support both situations. Link: https://lore.kernel.org/tools/20220225031135.4136158-1-robh@kernel.org/ Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-06-14Update patatt to latestKonstantin Ryabitsev
This will soon become patatt-0.5.0, so start using it in our daily tests. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-03-30Add support for mailmap and excluding mail in b4-tyKonstantin Ryabitsev
With codeaurora.org accounts no longer accepting mail, add support to exclude addresses when generating b4-ty mail. Additionally, support mailmap replacements by running every address through "git check-mailmap". Requested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2022-02-01Allow whitespace at the start of non-wrapped trailersKonstantin Ryabitsev
Sometimes folks indent their trailers with whitespace, so relax the rules to recognize this situation. In theory, this shouldn't introduce false-positives. Suggested-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20211214214327.4003631-1-robh@kernel.org Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-11-02Reimplement unicode control character logicKonstantin Ryabitsev
Instead of hardcoding the logic to bail at all presence of control characters, soften it a bit to only error out when we see the presence of Cfs in the absence of any other character from a non-latin character set in the same line. Additionally, show exactly where the Cfs were found when printing out the error message. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-11-01mbox: initial support to check for unicode control charsKonstantin Ryabitsev
Implement initial support for checking if the patch message contains unicode control characters that can be used to trick code reviewer into accepting maliciously formatted code. Link: https://lore.kernel.org/tools/20211101175020.5r4cwmy4qppi7dis@meerkat.local/ Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-11-01ty: fix problems with smtplib and 8BITMIMEKonstantin Ryabitsev
There appears to be a bug in smtplib that doesn't properly support 8-bit content even when upstream SMTP gateway supports 8BITMIME (they all do, it's not 90s any more). Work around this by passing the message payload as bytes instead of string. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-10-20ty: fix bugs introduced when switching -s to -tKonstantin Ryabitsev
Test out and fix the bugs introduced by switching flags. Reported-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-10-20ty: document flag changesKonstantin Ryabitsev
We've replaced "b4 ty -s" with "b4 ty -t" to better disambiguate it from "b4 -S" which does the actual mail sending. This commit documents this change, plus adds -S,--send-email and --dry-run flags. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-10-20shazam: change default behaviour to be "apply-here"Konstantin Ryabitsev
Based on the feedback, change the default behaviour of "b4 shazam" to apply patches to the current tree instead of doing FETCH_HEAD magic. This is still available when used with -H,--make-fetch-head flag. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-10-19Initial implementation of native mail sendingKonstantin Ryabitsev
I'm felling comfortable that "b4 ty" is sufficiently mature at this point to implement sending thank-yous directly. This is only the initial implementation that covers only the very basic parts of git's sendemail configuration options, but this should actually cover 90% of cases if not more. One important caveat -- I moved the "b4 ty -s" flag to be "b4 ty -t" in order to disambiguate it from the capital -S (that actually does the sending). Since "b4 ty" is still marked as an experimental feature, I feel we can do this without much impact. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-10-19Fix shazam for multiple git worktreesRob Herring
The shazam command makes assumptions that '.git' is a directory which is not the case with multiple worktree. Use 'git rev-parse' instead to retrieve the correct paths. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://lore.kernel.org/r/20211019144600.225058-1-robh@kernel.org
2021-10-07validate: Use patatt's configured keyring as fallbackKees Cook
If b4 doesn't have an explicit keyringsrc configured, attempt to fetch it from patatt configuration instead. This avoids some very confusing situations where patatt would validate and b4 would reject. (I had an expired pubkey in my gpg default keyring, but the same pubkey had an updated expiration date in patatt's keyring.) Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://lore.kernel.org/r/20211007165551.2312946-1-keescook@chromium.org
2021-10-07Add keyring key for keescookKonstantin Ryabitsev
Add Keys Cook's key to the repo keyring, since he's sending lots of patches lately. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-30shazam: document template usage in manpageKonstantin Ryabitsev
The flags and functionality of shazam may still change, so not documenting the rest of the usage yet. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-30shazam: implement custom merge message templatesKonstantin Ryabitsev
Allow people to set up their own preferred merge templates, using the netdev standard as default. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-29shazam: implement better merging stringsKonstantin Ryabitsev
b4 shazam will now: 1. give you a better default message for merging FETCH_HEAD 2. reuse the conver letter for the merge message, giving you the example invocation for using it Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-29shazam: allow configuring "git am" flagsKonstantin Ryabitsev
Setting b4.git-am-flags should allow you to specify what additional flags to pass to "git am" before shazaming a bunch of patches on to the current branch. Example entry in ~/.gitconfig [b4] git-am-flags = -s Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-24am/shazam: Restore thank-you recordingKees Cook
After the shazam refactoring, the thank-you recording went missing from both the "b4 shazam -A" and "b4 am" workflows. Restore the calls. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-21Simplify sparse worktree preparationKonstantin Ryabitsev
Looks like we don't need to have the files in place to run "git am", so skip that step and just init the sparsest possible tree. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-21Add "b4 shazam" that is like b4 am + git amKonstantin Ryabitsev
By popular demand, provide a way to apply series straight to a git repository. By default, we're still going the safest possible route: - create a sparse worktree consisting just of the files being modified - run "git am" against the temporary worktree - if "git am" went well, fetch from the temporary worktree into our current tree and leave everything in FETCH_HEAD - unless we're running "b4 shazam -A" in which case we just apply to the current HEAD (exact equivalent of b4 am -o- | git am) Further changes to come based on feedback. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-09-01Up version to 0.8.0 and prep for relasev0.8.0Konstantin Ryabitsev
New version of lore.kernel.org is live today, so release the version of b4 that works best with it. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-25Normalize linebreaks when reconstituting bodyKonstantin Ryabitsev
When generating am-ready patch series, separate each standard body part with a single pair of newlines regardless of how many the original message contained. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-18Document listid-preference config parameterKonstantin Ryabitsev
When we query /all/, we often get duplicates if a message was crossposted to multiple lists and some of those lists altered the message subject/body (e.g. legacy mailman, groups.io, etc). The listid-preference parameter allows us to dedupe based on lists that are least likely to mangle the messages. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-18Missed backfill call cleanupKonstantin Ryabitsev
We no longer support backfilling (obsolete), so remove it from all places where it's used. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-18Remove kludges that were needed before /all/Konstantin Ryabitsev
Extindex allows us to get rid of a couple of kludges: - we no longer need to manually backfill, as /all/ contains all sources - we can just query /all/ for new series Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-17Filter duplicate results when querying new seriesKonstantin Ryabitsev
When querying against /all/, we may get multiple hits for the same subject, so deal with it early. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-17Move dedupe code into central locationKonstantin Ryabitsev
We want to dedupe all threads we retrieve from public-inbox, so do this in the central place instead of only when doing get_strict_tread(). Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-17Reimplement deduping based on list-id preferenceKonstantin Ryabitsev
Instead of relying on DKIM validation, use list-id preference when dealing with multiple messages matching the same message-id. We may end up adding an attestation check to it as well in the future. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-16When deduping, prefer DKIM-validating messagesKonstantin Ryabitsev
With newer lore.kernel.org and /all/, we get duplicate messages when message bodies are different due to one of the messages passing through a DKIM-compliant list, and another one through something that injects in-body or in-subject junk. When dealing with duplicates, check both for DKIM status and prefer the message that actually passes DKIM validation. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-05Handle decoding incorrectly encoded headersKonstantin Ryabitsev
Sometimes the encoding indicated in the header lies and it's not actualy that codepage at all. When that happens, just replace errors and continue. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-03Parse just headers when extracting message ID from stdin mboxKyle Meyer
When the mbox and am subcommands grab a message ID from the mbox on stdin, they call message_from_bytes(), which in turn calls BytesParser().parsebytes(s). parsebytes() has a headersonly parameter that can be used to tell it to stop parsing after reading the headers. The headers are all that's needed here, so use BytesParser directly and set headersonly. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Link: https://lore.kernel.org/tools/20210717164836-mutt-send-email-mst@kernel.org/ Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-03Avoid decoding errors when extracting message ID from stdinKyle Meyer
The mbox, am, and pr subcommands accept an mbox on stdin and extract the message ID. When stdin.read() is called, Python assumes the encoding is locale.getpreferredencoding(False). This may not match the content encoding, leading to a decoding error. Instead feed the stdin bytes to message_from_bytes(), which leads to a decode('ASCII', errors='surrogateescape') underneath. That's sufficient to get the message ID from the ASCII headers. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-03Don't consider signature contents for trailersKonstantin Ryabitsev
Drop anything in the body below "-- " before parsing the contents for trailers. This won't catch all possible situations, as the "-- " standard is a bit of a dying standard, so add a list of known baddies like "Phone:" and "Email:" that are likely to trip us up. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/tools/20210719213535.vw3u4yg5mgxqysaf@pengutronix.de/ Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-03Sanitize msgid before using it as savenameKonstantin Ryabitsev
Before using the msgid as part of the filename, clean it up to only contains sensible characters. Reported-by: Rob Herring <robherring2@gmail.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-06-22Fix wrong statement on patches without indexesKonstantin Ryabitsev
Some patches don't have index information, so don't say they "apply clean to current tree" when they don't. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-06-22Allow '.git' to be a file for worktreesRob Herring
With multiple git worktrees, '.git' can be a file pointing to the real '.git' directory, so the current check for a directory is too strict. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://lore.kernel.org/r/20210621204335.1627303-1-robh@kernel.org