summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-11-17Add '.venv' to .gitignorePhilippe Blain
When using the built-in Python3 module 'venv' to create a virtual environment, it is common to name the folder containing the virtual environment '.venv' [1]. To help developers wishing to use a virtual environment to develop the project, add '.venv' to the .gitignore file. [1] https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
2020-11-03Use raw strings to avoid unnecessary backslashesKonstantin Ryabitsev
Use r'' strings uniformly to avoid needing to escape backslashes. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-11-03Fix handling of series with the [PATCHvX] defectMarc Zyngier
b4 tries to handle subject lines such as "[PATCHvX]" by replacing the subject line in situ, but seems to do a rather bad job of it, resulting in only the first patch of the series being picked up. Fetching <20201026134931.28246-1-mark.rutland@arm.com> does exhibit the problem. Fixing the re.sub() expression allows normal funtionalities to be restored, and the above series to be fetched. Fixes: 6bf644f14b3f ("Deal with [PATCHvX] subject") Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-27Fix a crasher discovered in testingKonstantin Ryabitsev
Don't crash on incomplete threads when trying to carry over previous trailers. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-27Fix attestation code for base64-encoded messagesKonstantin Ryabitsev
We need to fix all legacy encodings before we pass an email to git-mailinfo. Additionally, even if that fails, don't crash on a missing attestation. Reported-by: Greg Kroah-Hartman <greg@kroah.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-26Create an attid for unchange patch trackingKonstantin Ryabitsev
The new attestation code did away with attid, but we still use it for tracking unchanged patches between series. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-19Fix Link: and Cc: trailer recognitionKonstantin Ryabitsev
Link is a non-person trailer, so should be recognized as such. Cc is a person-trailer but we always expected that to include <> surrounding the address, which is not correct in all cases. Reported-by: Greg Kroah-Hartman <greg@kroah.com> Reported-by: Johan Hovold <johan@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-02Fix header encoding introduced by earlier fixKonstantin Ryabitsev
It seems we don't have much control over what as_bytes() does, so switch to using as_string(), setting our policy, and making sure that content-transfer-encoding is set to 8bit. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-02Reimplement attestation for in-header hashesKonstantin Ryabitsev
Rewrite attestation to implement in-header hashing and signing. For now, just implementing mode=pgp, but other modes are coming next. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-02Fix some cherry-picking corner casesKonstantin Ryabitsev
Handle several corner cases when trying to cherrypick from incomplete series. Reported-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-02Don't crash when no valid patches are foundKonstantin Ryabitsev
Error out when we don't find any patches in an mbox when trying to diff series. Reported-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-02Use bytes when dumping to stdoutKonstantin Ryabitsev
We don't need to needlessly convert to unicode when dumping to stdout, especially when it can lead to crashers when we encounter other charsets. Reported-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-10-01Set charset in order to generate MIME headersKonstantin Ryabitsev
Apparently, merely passing policy= doesn't generate the full set of required headers, so make sure we do set_charset('utf-8'). Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-10Use a more precise regex for email trailersKonstantin Ryabitsev
Still seeing false-positives for personal follow-up trailers, so tighten a regex a bit further to make sure we don't match bogus content. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-10Tighten follow-up header parsingKonstantin Ryabitsev
The combined routine was too broad for parsing follow-up messages, so this tightens it to avoid too many false positive matches. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-09Initial go at supporting [extra trailer data]Konstantin Ryabitsev
A common request is to support trailers that contain extra data in the following format: Reviewed-by: D. Eveloper <d.eveloper@example.com> [for the code in foo.h] This should do the right thing now, and moves trailer searching into one place instead of being reimplemented twice. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-09Don't force trailers into a setKonstantin Ryabitsev
Fixes sloppy-trailers. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-09Preserve trailer order by defaultKonstantin Ryabitsev
Per discussion on the users list, preserve the trailer order by default. There is no agreement on whether this is a hard requirement for patches or not, but there is general consensus that the default should be to make as few changes to incoming patches as possible. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-09Use shorter cache file namesKonstantin Ryabitsev
Use shorter cache filenames to avoid running into OSError. Reported-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-09-09Remove redundant backslash escapes in regexesKonstantin Ryabitsev
PyCharm thinks they are redundant, and they indeed appear to be. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-08-18Require that a trailer is at least 2 chars longKonstantin Ryabitsev
I can't think of any trailers that are shorter than 2 characters, so tweak the regex to avoid one of the possible false positives. Reported-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-08-18Cover letters may not have a diffstatKonstantin Ryabitsev
Don't check if a potential cover letter has a diffstat when processing follow-up trailers. Reported-by: Greg Kroah-Hartman <greg@kroah.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-27Fix some of the more common trailer wrappingKonstantin Ryabitsev
When copypasting patches into mail clients, trailers sometimes get mangled due to MUAs helpfully breaking long lines. Not sure if this causes more harm than good, but let's try to run some tests with this. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-27Fix handling of single-paragraph commit message bodiesKyle Meyer
The get_body_parts() method added in ba6c790 (Parse body parts into usual chunks, 2020-04-27) strips lines that look like trailers from the last paragraph, storing the other lines to add back to the message. However, if the commit message has only a single paragraph, get_body_parts() returns early, unconditionally returning an empty string for the message even if non-trailer lines were encountered. Return the collected non-trailer lines, if any, as the message. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-27Fix basement detection for empty commit message bodiesKyle Meyer
The get_body_parts() method added in ba6c790 (Parse body parts into usual chunks, 2020-04-27) splits the commit message body on "\n---\n" and takes the second half as the "basement" of the patch. The body is stripped of flanking new lines, though, so a delimiter beginning with a new line isn't appropriate for commit messages without a message body. Make the starting new line optional. Note that this doesn't matter in the end in terms of the final applied patch. Before 31f33fd (Fix body part parsing when '---' is not used, 2020-06-08), the expected patch output was produced despite the diff lines being processed as the message body. After that commit, the information following the triple dash is a bit off, but it doesn't matter because git discards it anyway. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-27Support mbox -m to be a maildirKonstantin Ryabitsev
It's a simple if/else to support maildirs for local operations, so let's handle mbox -m to be a maildir. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-07man: Update commit url mask to contain 12 chars of IDTudor Ambarus
Use 12 characters for the commit ID, similar to what git log --oneline uses. 10 chars of ID is sometimes not enough and git.kernel.org returns "Bad object ID". Example: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=482dcb2a04 Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-07Fix attestation error messagesKonstantin Ryabitsev
Fix a crash when multiple patches fail attestation. Also fixes fancy chechmarks. Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-06Deal with [PATCHvX] subjectsKonstantin Ryabitsev
Normally, we'd expect to always have a space between PATCH and other prefixes, but be forgiving if it's not present. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-07-06Fix crash when -c used with incomplete seriesKonstantin Ryabitsev
Return early if we don't have a cover letter or patch 1/X to use as basis for the subject-based query. Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-26man: Drop the apostrophe from the linkmask configurationTudor Ambarus
An apostrophe was added at the end of each generated link. Drop it. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-12Fix crash with unbalanced [] in subjectKonstantin Ryabitsev
Don't crash if there is no matching ] in the subject. The culprit: https://lore.kernel.org/lkml/20200612142621.GA8009@lenoir Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-10Fix regression with oddball charsetsKonstantin Ryabitsev
Fix the same bug we've fixed before in another place -- when charset is set to oddball value like charset=a, fallback to utf-8 and hope for the best. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-08Fix mbox naming inconsistenciesKonstantin Ryabitsev
Fix mbox file naming problems introduced by adding "-o -". Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-08Output less confusing trailer mismatch messagesKonstantin Ryabitsev
Show the actual trailer name we're complaining about. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-08Fix bug with threading when cover ref is missingKonstantin Ryabitsev
When the cover letter is missing and we're starting in the middle of the thread, do not discard messages in the mbox that come before the msgid that we want. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-08Fix body part parsing when '---' is not usedKonstantin Ryabitsev
If the commit message is not separated from the diff using '---' as is commonly the case, fall back to splitting by the word "diff". Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-06-08Use proper charset when reading back mailinfoKonstantin Ryabitsev
Git mailinfo output is going to be in the same character set as specified in the message headers, so we should not assume that we can read it back in unicode. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-28Don't output git am suggestion for -o -Konstantin Ryabitsev
Since we're piping out to stdout, there's obviously no reason to show what the "git am" command should be -- especially if we delete the temporary mbox file after the command completes. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-28Add --no-cover and -o - to output to stdoutKonstantin Ryabitsev
By request, provide a way to output the results of b4 am to stdout. This way it can be piped straight to "git am". E.g.: b4 diff 20200526205322.23465-1-mic@digikod.net -o - | git am Requested-by: Rob Herring <robh@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-26Use unicode escape sequencesKonstantin Ryabitsev
Let's keep our code sources in plain old ascii. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-26Up the version to 0.6.0-devKonstantin Ryabitsev
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-25Prepare for 0.5.0v0.5.0Konstantin Ryabitsev
I think it's time to have more people poking at the diff functionality. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-25Backfill series before diffing themKonstantin Ryabitsev
Make sure we a) attempt to backfill the series if they are incomplete, b) error out if the series is incomplete anyway Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-25Add -3 to "b4 am" to prep for a 3way mergeKonstantin Ryabitsev
The original code used for b4 diff was to prepare for a 3-way merge by making sure that all blob indexes exist in the local repo. Add this functionality to "b4 am" and document all the features added in the 0.5.0 branch. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-22Suggest what to do when auto-find failsKonstantin Ryabitsev
When we can't auto-find the previous version (usually because the cover letter subject changes), suggest what to do: run b4 am -T and b4 diff on both mboxes. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-22Add ability to diff arbitrary mbox filesKonstantin Ryabitsev
Sometimes we are unable to properly look up previous series -- usually because the cover letter title changes. For those cases, it is now possible to diff two arbitrary mbox files prepared with "b4 am -T". There's also a smattering of other fixes in there because I'm too lazy to properly stage my patches. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-21Do not crash when versions are specifiedKonstantin Ryabitsev
Also, make sure we display which versions we are diffing. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-19Display range-diff by defaultKonstantin Ryabitsev
Don't make developers do copy-pasting unnecessarily. Switch to outputting the diff by default, with flag options to save to file or just show what needs to be done. Additionally, adds caching to lookups and remember previously generated fake-am ranges so we don't continuously generate loose objects on repeat runs. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2020-05-15Don't try to compare version to itselfKonstantin Ryabitsev
Need to figure this out earlier, but at least don't try to compare two versions to itself. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>