summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/parser.py
Commit message (Collapse)AuthorAgeFilesLines
* Move to a more recent django project structureJeremy Kerr2015-05-271-267/+0
| | | | | | | | | | This change updates patchwor to the newer project struture: we've moved the actual application out of the apps/ directory, and the patchwork-specific templates to under the patchwork application. This gives us the manage.py script in the top-level now. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Fix parsing of patches with a trailing no-newline markerMichael Ellerman2015-03-221-0/+5
| | | | | | | | | | | If a patch ends with a "No newline at end of file" marker, it is incorrectly considered part of the comment. Add a testcase which shows the bug, and then fix the parser. The parser fix is hopefully sufficiently specific so as to not break any other unrelated case. But .. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
* Always use #!/usr/bin/env pythonDamien Lespiau2015-03-221-1/+1
| | | | | | | | | Hardcoding the path to the python binary breaks virtualenv. virtualenv creates a special python binary in the path, and specifically using /usr/bin/python breaks that. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Add support for rename-only patchesJeremy Kerr2013-10-131-0/+21
| | | | | | | | | | | | | Yann E. MORIN reported a problem where patchwork drops patches with only renames: http://lists.busybox.net/pipermail/buildroot/2013-October/079999.html This change fixes the issue by adding a new state for patch 'meta' headers: header test which is not parsed as a hunk, but has the same behaviour as a hunk in that it will cause the patchbuf to be populated. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: allow words starting with "diff" at beginning of lineStefan Hajnoczi2012-01-141-1/+1
| | | | | | | | | | | | | | | The patch parser splits emails incorrectly when the comment contains a line whose first word starts with "diff" (like "difficult" or "different"). For a real-life example of an email that triggers this bug, see http://patchwork.ozlabs.org/patch/135291/. Fix the issue by checking for a space after "diff". Add DiffWordInCommentTest to the test suite. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Revert "Decode patch from UTF-8 while parsing from stdin"Jeremy Kerr2011-02-101-1/+2
| | | | | | | | | This reverts commit 7fd7d0bbe4e3fce405e02e9e630ef70023fdd43e. parse_patch() will never be handed anything but unicode, so no need to do the decode. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Decode patch from UTF-8 while parsing from stdinmartin f. krafft2010-12-131-2/+1
| | | | | | | | | | | | | | Patchwork (rightfully) hashes patches using UTF-8: parser.py: def hash_patch(str): […] hash.update(line.encode('utf-8') + '\n') This patch makes sure that it treats the incoming data as UTF-8 as well. Signed-off-by: martin f. krafft <madduck@madduck.net> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: decode stdin from utf-8Jeremy Kerr2010-08-101-1/+4
| | | | | | | We need to decode stdin from the patch parser as UTF-8, rather than python assuming ascii. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [parser] Handle special case of "New newline at end of file"Nate Case2008-10-231-0/+3
| | | | | | | | | | | | | | | If a file doesn't have a newline at the end, diff will insert a "\ No newline at end of file" line in the middle of the last hunk. parser.py was counting this line as part of the hunk line count. This had the side effect of putting the last line of the hunk in the patch comment, and truncating out the last line of the diff. Handle this special case by not including this line in the internal line counter. This appears to be the only case where diff will insert a string like this within a hunk. Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Make parser.py invokation a little more flexibleJeremy Kerr2008-09-101-5/+25
| | | | | | | Add options to control output, allowing us to use the parser to generate patch hashes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Hook-up hashing infrastructureJeremy Kerr2008-09-091-2/+59
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move patchparser to patchwork.parserJeremy Kerr2008-09-091-0/+158
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Remove unused parser.py fileJeremy Kerr2008-09-091-211/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* In some places tabs are used instead of spaces for indentation,Nate Case2008-08-231-3/+3
| | | | | | | | | | | even when other lines of a method are indented with spaces. This gets rid of all tabs and uses spaces everywhere. [Reworked to apply on newer code by Jeremy] Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Eliminate hashlib requirementNate Case2008-08-231-2/+7
| | | | | | | | If the hashlib module does not exist, use sha and md5 modules instead to support Python 2.4. The hashlib module was added to Python 2.5. Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Inital commitJeremy Kerr2008-08-211-0/+206
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>