summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* patchwork/templates: Suppress cycle template tag warningHEADmasterJeremy Kerr2015-06-051-0/+2
| | | | | | | | | | | Running on django 1.7 gives a warning: RemovedInDjango18Warning: 'The `cycle` template tag is changing to escape its arguments; the non-autoescaping version is deprecated. Load it from the `future` tag library to start using the new behavior. Although this change doesn't affect this template, suppress the warning by loading from the future library. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork/views: request.REQUEST is deprecated in django 1.8Jeremy Kerr2015-06-052-5/+15
| | | | | | .. so do explicit accesses to request.GET or request.POST. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork/parser: Adapt for new unsaved-foreign-key behaviour in django 1.8Jeremy Kerr2015-06-051-6/+10
| | | | | | | | | | | | | | | | | | | | | | | Django 1.8 no longer supports assignment of unsaved models to ForeignKey fields: File "/home/jk/devel/patchwork/patchwork/tests/test_patchparser.py", line 75, in setUp (self.patch, self.comment) = find_content(self.project, email) File "/home/jk/devel/patchwork/patchwork/bin/parsemail.py", line 231, in find_content headers = mail_headers(mail)) File "/home/jk/devel/patchwork/lib/python/django/db/models/base.py", line 468, in __init__ setattr(self, field.name, rel_obj) File "/home/jk/devel/patchwork/lib/python/django/db/models/fields/related.py", line 668, in __set__ (value, self.field.rel.to._meta.object_name) ValueError: Cannot assign "<Patch: Test Subject>": "Patch" instance isn't saved in the database. Even though we'd be guaranteed to save the patch before the comment, we need to avoid this error. This change defers the assigment of Comment.patch until we know we have a saved Patch instance. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork: Add initial migrationsJeremy Kerr2015-06-052-0/+248
| | | | | | | | Add migrations for the patchwork app; these will be required for django-1.9, and are required to express the test dependencies (to the auth models) on 1.8. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork: Explicitly load states fixturesJeremy Kerr2015-06-0511-6/+32
| | | | | | | | | | | Apps with migrations will no longer load the initial_data fixtures by default. In order to prepare to add migrations to patchwork, rename the initial_data fixture to default_states (to match the default_tags fixture), and explicitly load them in tests that require them. Also, include this step in the INSTALL document. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork/views: prefetch delegate in generic_listJeremy Kerr2015-06-051-1/+1
| | | | | | | | If patches have a delegate, the patch list template will cause a query to render the delegate username. Instead, we should include the delegate in the select_related query. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork/models: Use OneToOneField for PatchChangeNotifcation.patchJeremy Kerr2015-06-041-1/+1
| | | | | | Same functionality, but we suppress an error from django 1.8+ Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsemail: Don't catch all exceptions when a Project isn't foundJeremy Kerr2015-05-291-1/+1
| | | | | | | This is the first query that parsemail will do, and we don't want to lose any non-missing-project-related errors. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsemail: run django.setup to initialise ModelsJeremy Kerr2015-05-291-0/+2
| | | | | | | From 1.7 onwards, we need to call django.setup() before we can use the Model interfaces. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Remove old-style test runner moduleJeremy Kerr2015-05-285-89/+45
| | | | | | | | | | | | | | | We get the following warning on django 1.7: System check identified some issues: WARNINGS: ?: (1_6.W001) Some project unittests may not execute as expected. HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information. This change removes the unneeded base test module, and moves the patchparser doctests into a proper test module. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* cron: Move patchwork-cron script to a management commandJeremy Kerr2015-05-284-18/+28
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork/utils: Remove unnecessary MultiplePatchForm importJeremy Kerr2015-05-281-1/+0
| | | | | | It's not used in utils.py Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* doc: Add NEWS file for recent updatesJeremy Kerr2015-05-281-0/+60
| | | | | | ... containing a guide to migrating to the recent changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add patch tag infrastructureJeremy Kerr2015-05-2817-8/+469
| | | | | | | | | | | | | | | | | | | | | This change add patch 'tags', eg 'Acked-by' / 'Reviewed-by', etc., to patchwork. Tag parsing is implemented in the patch parser's extract_tags function, which returns a Counter object of the tags in a comment. These are stored in the PatchTag (keyed to Tag) objects associated with each patch. We need to ensure that the main patch lists do not cause per-patch queries on the Patch.tags ManyToManyField (this would result in ~500 queries per page), so we introduce a new QuerySet (and Manager) for Patch, adding a with_tag_counts() method to populate the tag counts in a single query. As users may be migrating from previous patchwork versions (ie, with no tag counts in the database), we add a 'retag' management command. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Add collectstatic step to installation instructionsJeremy Kerr2015-05-281-1/+5
| | | | | | | Because we're now using the staticfiles app, we need to run collectstatic on init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Update documentation and default settings to suit patchwork deployment modelJeremy Kerr2015-05-285-68/+71
| | | | | | | | | | | | We've always allowed configuration without altering any of the version-controlled files. With the recent settings changes, we have an extra level of indirection with the dev/prod settings modules. Since we have to edit a config file anyway, this change moves the prod.py settings file to a template, which is then used directly by mange.py (and the wsgi application). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* bin: Fix references to old settings module locationJeremy Kerr2015-05-271-1/+1
| | | | | | | Since the settings modules have changed locations, we need to update the parsemail script too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Fix documentation for new settings infrastructureJeremy Kerr2015-05-271-1/+2
| | | | | | | A few tweaks for the INSTALL doc to update to the settings changes from c641660e. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/apache2: Update sample configuration files for new staticfiles applicationJeremy Kerr2015-05-271-17/+5
| | | | | | | The static files app will collect all of the static files into STATIC_ROOT, which is under htdocs/static/. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/apache2: use django-1.7-compatible wsgi applicationJeremy Kerr2015-05-271-2/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move to a more recent django project structureJeremy Kerr2015-05-27120-25/+23
| | | | | | | | | | 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>
* tox: Add tox.ini fileStephen Finucane2015-05-031-0/+46
| | | | | | | | | | | | | | | | | Currently this contains calls to execute the following on the code base: * Unit tests (for all currently supported versions of Django). This requires the addition of a "test" 'local_settings' file * PEP8 (or, rather, flake8) * PyLint * Coverage (based on unit tests) These are designed in such a way that it should be possible to easily add additional environment for testing (like Python3 or Django 1.8). Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Split 'settings.py' into multiple filesStephen Finucane2015-05-035-53/+123
| | | | | | | | | | | | | | This will make testing/developing a little easier and prevent people deploying insecure instances. This also adds references to Django documentation in said files (for Django novices) and restructures the files to group them together logically. This allows us to remove the settings file used for tests. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Integrate 'django.contrib.staticfiles'Stephen Finucane2015-05-0310-72/+64
| | | | | | | | | | Rather than providing a custom solution for serving static files, use the solution provided in the upstream Django source. This allows us to remove the top-level 'urls.py' file. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Restructure settings fileStephen Finucane2015-05-031-63/+78
| | | | | | | | | | | | | | Restructure to add some order to the settings file. This includes removing some variables: - TEMPLATE_CONTEXT_PROCESSORS - TEMPLATE_LOADERS These variables have the exact same value as the Django defaults and thus do not need to be specified. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Use 'prod' and 'dev' requirements filesStephen Finucane2015-05-036-9/+5
| | | | | | | | | | | | | | | | Django 1.5 and 1.6 are no longer supported. https://docs.djangoproject.com/en/dev/internals/release-process/ As a result, one should not encourage people to develop and/or deploy against these versions - the latest version of Django supported by patchwork (currently 1.7) should be used for both. In addition, rather than duplicating shared requirements for 'dev' and 'prod' environments, move all shared requirements to a "base" file. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Resolve all but one Django 1.7 warningStephen Finucane2015-05-031-3/+10
| | | | | | | | | Resolve remaining Django 1.7 warnings with the exception of a single deprecation warning. However, this remaining issue is really a non-issue due to the limited (and non-offending) use of the code. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views: Replace 'mimetype' with 'content_type'Stephen Finucane2015-05-033-6/+6
| | | | | | | | | | | | | | Passing 'mimetype' to 'HttpResponse' is deprecated in 1.6 and removed in Django 1.7. Among other things, this causes some unit tests to fail when using Django 1.7. Its replacement - 'content_type' - is available in Django 1.5+. This can be seen here: https://docs.djangoproject.com/en/1.5/ref/request-response/#django.http.HttpResponse.__init__ This is therefore a like-for-like replacement. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Resolve removed 'AUTH_PROFILE_MODULE' settingStephen Finucane2015-05-0313-32/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'AUTH_PROFILE_MODULE' setting, and the 'get_profile()' method on the 'User' model are removed in Django 1.7. This causes errors when using Patchwork with Django 1.7+. There are three changes necessary: * Replace profile model's 'ForeignKey' with a 'OneToOneField' * Remove all 'get_profile()' calls * Delete 'AUTH_PROFILE_MODULE' settings from 'settings.py' These changes are discussed here: http://deathofagremmie.com/2014/05/24/retiring-get-profile-and-auth-profile-module/ Django 1.6 also introduces two other notable changes: * The 'XViewMiddleware' module has been moved * A new test runner has been introduced It is not possible to fix these issues without breaking compatibility with Django 1.5. As a result they have been ignored and must be resolved in a future release. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Make the submitter name link to a query for that submitterMichael Ellerman2015-05-033-6/+9
| | | | | | | | | | | | | | | | | | | | | | Currently the submitter name is rendered as a mailto: link. This is possibly useful in some circumstances, but in my experience is not usually what I want. Although it opens a mail to the submitter, it doesn't include any of the patch context, so is not very helpful. Instead the submitter link can be a link to a query for patches by that submitter. In my experience that is more useful, ie. when looking at a single patch for a submitter you can then quickly get the list of all patches by them. So do that conversion. In order to do it we need to know the current project, so that becomes a parameter to personify. I believe the url reversal is correct, though it's not pretty, and pulling SubmitterFilter.param out feels a little wrong, but is the best solution I could come up with. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: honor PAGER for viewaldot2015-05-031-4/+19
| | | | | | | Use the PAGER of the environment to view patches Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Fix parsing of patches with a trailing no-newline markerMichael Ellerman2015-03-223-0/+65
| | | | | | | | | | | 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>
* INSTALL: Fix indentation (whitespace only change) to 4 spacesBryce Harrington2015-03-221-46/+57
| | | | | | | Also, 2 newlines after each section. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* INSTALL: Fix some minor typosBryce Harrington2015-03-221-4/+4
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Always use #!/usr/bin/env pythonDamien Lespiau2015-03-223-3/+3
| | | | | | | | | 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>
* pwclient: support 'archived' filtering and updatingBrian Norris2015-03-221-2/+17
| | | | | | | | | | | | | | | | | | | | | | Examples: # Mark patch as uperseded and archived pwclient update -s Superseded -a yes <ID> # List all archived patches pwclient list -a yes Notably, we still leave the '-s' option as required for 'pwclient update'; so you can't *just* archive a patch without setting its state. I couldn't quite figure out the right argparse usage to represent that the user must include one or both of '-s' and '-a'. And of course, the server must have an updated xmlrpc that supports the 'archived' field for list filtering (recently patched), otherwise you'll just get an empty list. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: drop unused variablesBrian Norris2015-03-221-1/+0
| | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* xmlrpc: support filtering by 'archived'Brian Norris2015-03-221-0/+1
| | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: exit on first patch which fails to applyBrian Norris2015-03-221-2/+9
| | | | | | | | | | | | | When run with more than one patch ID, the 'apply' and 'git-am' commands should not continue to process other patches if an earlier one failed. We should stop so the user can address the situation. Future work: it'd be nice to just pipe all the patches at once to git-am, so that git's nice handling of fixup-and-continue workflow can be used. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add project option to single-patch commandsBrian Norris2015-03-221-0/+4
| | | | | | | | | | | | | | | | | | Previously, we could not target a particular server instance with the apply, git-am, info, and view subcommands. Under a single-server design, we never needed to target a particular project for a patch. We just targeted the patch itself. But with the advent of multi-server .pwclientrc configurations, we should allow pwclient to specify the project for these commands. This adds the '-p PROJECT' option to: * apply * git-am * info * view Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* INSTALL: fix mysql syntaxBrian Norris2015-03-221-1/+1
| | | | | | | You shouldn't quote ('') the database name. MySQL complains if you do. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* TODO: remove completed itemsBrian Norris2015-03-221-4/+0
| | | | | | | | | IIUC, these items have all been completed. (The 'bundle' part of --signoff is not completed, but that is represented in the previous bullet.) Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* xmlrpc: include UNIX mbox 'From ' header in patch_get_mbox()Brian Norris2015-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This function is misleadingly named 'mbox'; the contents do not begin with a proper 'From xxx <date>' separator line. (Notably, the mbox format does not have an authoritative standard, but at least this basic 'separator' construct is noted in http://tools.ietf.org/html/rfc4155.) The Message.as_string() function takes an optional [unixfrom] boolean argument. Let's use it, like we do everywhere else (including in the web interface 'mbox' link). Among other things, this means that we can straightforwardly concatenate the output of patch_get_mbox(), and more tools can use this output as-is. Example header: >From patchwork Fri Nov 21 18:24:29 2014 ... Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* xmlrpc: add 'archived' status to patch summaryBrian Norris2015-03-221-0/+1
| | | | | | | This will now show up in 'pwclient info'. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/xmlrpc: fix xmlrpc delegate filteringJohannes Berg2015-03-221-0/+3
| | | | | | | | | | | | Trying to use pwclient list -d 'johannes@sipsolutions.net' doesn't result in any patches listed - it seems that the filter is constructed wrongly on the xmlrpc server side (going by how the submitter filter is done.) Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test_notifications: Fix testNotificationUpdated timestamp comparisonDamien Lespiau2014-11-101-1/+1
| | | | | | | | | | | With MySQL, the django ORM defaults to mapping DateTimeField to Timestamp and this has only a precision of seconds. Let's use >= here then, which doesn't affect the correctness of this test. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Add a note about how to run testsDamien Lespiau2014-11-101-0/+16
| | | | | | | | Given that hacking on patchwork is spaced in time, I always forget how to do this. So write down a note. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* jquery: Fix jqeury typoDamien Lespiau2014-11-101-1/+1
| | | | | Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsemail: Honour existing PYTHONPATHDamien Lespiau2014-11-101-1/+1
| | | | | | | | | For setups where the patchwork dependencies are not part of the system packages, one needs to indicate where to find them. parsemail.sh was overriding PYTHONPATH without leaving us a chance to join in. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Add the Debian package name for virtualenv/mysqlDamien Lespiau2014-11-101-1/+2
| | | | | Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>