aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* pwclient: support signoff in the pwclientrcBernhard Reutner-Fischer2014-09-07
| | | | | | | | | | | | Try to obtain git-am '--signoff' settings from: - the commandline - the global option section - per-project section v2: handle NoOptionError Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Remove now obsolete usage()Bernhard Reutner-Fischer2014-09-07
| | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: simplify hash/id handlingBernhard Reutner-Fischer2014-09-07
| | | | | | | and obtain "action" from args.subcmd while at it Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add git-am -s supportBernhard Reutner-Fischer2014-09-07
| | | | | | | Optionally pass --signoff to git-am Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsemail: Fallback to common charsets when charset is None or x-unknownSiddhesh Poyarekar2014-07-24
| | | | | | | | | | | | | | We recently encountered a case in our glibc patchwork instance on sourceware, where a patch was dropped because it had x-unknown charset. This change adds a fallback on a set of encodings (instead of just utf-8) when the charset is not mentioned or if it is set as x-unknown. Minor changes and testcase by Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Siddhesh Poyarekar <siddhesh@redhat.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* post-receive: exclude commits from the patch update stepBrian Norris2014-07-24
| | | | | | | | | | | | | | | | | | When merging upstream work related to other projects into your own project repository, you probably don't want to check for (and try to update) the status on every change-set in the merge. So add a list of references (branches, tags, commits, etc.) whose commits should be ignored in the patch update step. This could be used, for example, to set: EXCLUDE="refs/heads/upstream" Then when you're ready to merge in new upstream code, you first update the 'upstream' branch before pushing your own. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views: fix patch_to_mbox() for postscriptAndreas Bießmann2014-07-24
| | | | | | | | | Before we changed the comment 'some comment\n---\n some/file | 1 +' to 'some comment\n\n---\nsome/file | 1 +\n'. Now we pass this comment unchanged. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/mboxviews: test for unchanged postscriptAndreas Bießmann2014-07-24
| | | | | | | | | | | | | | Currently a patch containing postscript is always modified in patch_to_mbox() compared to the input patch. A comment containing 'some comment\n---\n some/file | 1 +' will be changed to 'some comment\n\n---\nsome/file | 1 +\n' which is annoying. This patch adds a test to detect that, a follow up patch will fix the error then. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings.py: use python to find ROOT_DIRAndreas Bießmann2014-07-24
| | | | | Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* INSTALL: adopt PYTHONPATHAndreas Bießmann2014-07-24
| | | | | Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* templates: fixup HTML tagsBrian Norris2014-07-04
| | | | | | | | | | These tags aren't matched appropriately. There may well be others, but I caught these by a mix of eyes and Firefox's source viewer. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add bash completion for project namesYann E. MORIN2014-07-04
| | | | | | | | Add initial bash-completion, which so far only completes on the project names. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: accept more than one project in ~/.pwclientrcYann E. MORIN2014-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, given the format of ~/.pwclientrc, pwclient can only really act on a single project, as ~/pwclientrc can only contain the configuration for a single project. Although the -p options comes in handy to specify a project different from the one configured in ~/.pwclientrc, this only works if it is hosted on the same server. As soon as one needs to switch server, it is necessary to edit ~/pwclientrc. This can be quite inefficient when dealing with many projects, hosted on different servers. Change the format of ~/.pwclientrc so it is possible to define more than one project, and for each project, specify an URL and credentials. The new format is like: [options] default = project-A [project-A] url = http://my.patchwork.server/path/to/xmlrpc username = that-is-me password = secret [other-project] url = http://you.get/the/idea username = someone password = 1234 This has the advantage of not changing the options to pwclient, so the user experience is unmodified. If a ~/.pwclentrc exists in the old format, it is automatically converted over to the new format, and the previous one is saved as ~/.pwclientrc.orig. Upon conversion, no action is made, pwclient just exits (with return-code 1) to inform the user to review the conversion. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: rename variable CONFIG_FILES to be singularYann E. MORIN2014-07-04
| | | | | | | | | | | We only support a single config file, so there is no need to have a plural in this variable. Also, we'll need to know what the default config file is, when we want to save it to migrate to the new format. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* filters: fix exception in filter querystring generationJeremy Kerr2014-06-03
| | | | | | | | | | | We get a silent (as it's during template render) exception when generating filter querystrings, as we're passing a list to the string format operator rather than a tuple. This change removes the map and explicitly applies sanitise to the (name, value) pair. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/utils: Fix List-Id headers on emails from create_emailJeremy Kerr2014-06-03
| | | | | | | | | We need to use the project's List Id in the List-Id header, not the linkname. We'll also need to populate the .listid member of defaults.project. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/generic_list: reduce number of queries in list renderingJeremy Kerr2014-05-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we do two database queries per patch on a list view; one to retrieve the submitter, and one for the state. This patch adds a .select_related to fetch for the submitter and state, and a .defer() to prevent loading large amounts of text data from the patch content and headers. This gives a significant reduction in the work per request. For a paginated list view (ie 100 patches per page): before after User 1344 ms 228 ms System 170 ms 25 ms Total 1514 ms 253 ms Elapsed 1605 ms 274 ms Context switch (vol) 4206 40 Context switch (invol) 326 75 SQL queries 212 15 Longest query 13 ms 5 ms Total query time 121 ms 20 ms Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* migration: Add cleanup-people migration scriptJeremy Kerr2014-05-08
| | | | | | | Now that we only create Person object once the User has been confirmed, we can clean up unused Person objects from the database. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* templates: display projects as inline-block elementsJeremy Kerr2014-05-07
| | | | | | ... rather than one long list. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* models: order projects by linkname by defaultJeremy Kerr2014-05-07
| | | | | | So we get a sensible list of projects on the front page's project list. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Add XMLRPC interface testJeremy Kerr2014-05-07
| | | | | | | | This change adds a simple test for the XMLRPC interface, essentially to ensure that configuration changes haven't broken accessibility to the interface. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* urls: Fix django-1.6 change in password change viewsJeremy Kerr2014-05-07
| | | | | | | The expected name for the password change views no longer has the auth_ prefix. This change fixes this and adds a testcase. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/xmlrpc: request.raw_post_data has been deprecatedJeremy Kerr2014-05-07
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/Order: Fix application of orderingJeremy Kerr2014-04-24
| | | | | | | We can't just re-apply orderings to the same queryset, we need to apply all at once. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs/INSTALL: Add setup details for patchwork cron scriptJeremy Kerr2014-04-24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Make tests compatible with django 1.6Jeremy Kerr2014-04-23
| | | | | | | The default test runner in django 1.6 relies on tests being named test*.py, rather that an explicit <appname>.test module. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix django-1.6 incompatibilitiesJeremy Kerr2014-04-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're seeing a couple of final quirks running the testsuite on django 1.6: Traceback (most recent call last): File "patchwork/apps/patchwork/tests/notifications.py", line 182, in testNotificationEscaping errors = send_notifications() File "patchwork/apps/patchwork/utils.py", line 227, in send_notifications delete_notifications() File "patchwork/apps/patchwork/utils.py", line 197, in delete_notifications pk__in = notifications).delete() File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 163, in filter return self.get_queryset().filter(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 590, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 608, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1198, in add_q clause = self._add_q(where_part, used_aliases) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1232, in _add_q current_negated=current_negated) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1122, in build_filter lookup_type, value) File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 1107, in get_lookup_constraint values = [get_normalized_value(value) for value in raw_value] File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 1084, in get_normalized_value value_list.append(getattr(value, source.attname)) AttributeError: 'PatchChangeNotification' object has no attribute 'id' - we're specifying our own pk here, so the PatchChangeNotification has no id attribute; it looks like the pk__in syntax is expecting IDs. We also need a default value for BooleanField, as we're getting integrity errors when creating rows with no explicit send_notifications set. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/utils: Don't rely on field error message APIJeremy Kerr2014-04-22
| | | | | | | The location of EmailField's message changed in 1.6, just use a fixed string instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/patchparser: Inherit from djagno.test.TestCaseJeremy Kerr2014-04-22
| | | | | | | Since these tests may touch the database, we need the transaction handling that django.test.TestCase provides. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/sql: remove references to auth_message modelJeremy Kerr2014-04-22
| | | | | | The Message model was deprecated in 1.4, and removed in 1.6 Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Defer Person creation/linkage until registration is confirmedJeremy Kerr2014-04-22
| | | | | | | | We currently create Person objects when a registration is submitted, not when it is confirmed. This can lead to stale Person objects for unconfirmed registrations. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add unconfirmed registration expiryJeremy Kerr2014-04-22
| | | | | | | | | | | | Currently, unconfirmed registrations remain in the database. Although we have an expiry for the registrations, we don't actually remove rows from the database. This can clog the admin interface up with unnecessary registration spam. We currently have a patchwork cron script to send notifications on patch changes, so hook this into a new do_expiry function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Update manage.py to post a post-1.4 version.Jeremy Kerr2014-04-22
| | | | | | | | | | Django version 1.6 deprecates some of the django.core.management API, so we need a post-1.4 version. The semantics with app include paths have changed with this version, so update the urlconf to use the same path as manage.py. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Remove references to django.conf.urls.defaultsJeremy Kerr2014-04-21
| | | | | | | django.conf.urls.defaults has been deprecated, replace with django.conf.urls, and remove the 'import *' syntax. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/order: Apply default ordering as secondaryJeremy Kerr2014-04-21
| | | | | | | | | | If we're ordering by a certain non-default field, then the ordering of patches with that same field will be arbitrary. This change applies the default as a secondary ordering, so we're not left with an arbitrary sub-order. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* post-receive: Fix error message when pushing to an unmapped branchCarl Worth2014-01-29
| | | | | | | | | | | | | | | | Previously, if STATE_MAP contained only refs/heads/master and a user pushed to a branch such as refs/heads/stable, the hook emitted a misleading error message: E: no mapping for refname refs/heads/master Fix this by correctly printing the reference being looked for, rather than the reference most recently found in STATE_MAP. Also, reword the message slightly to point the user to STATE_MAP and to use an actual word "branch" instead of the non-word "refname". Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: Add a pointer to the git post-receive hookCarl Worth2014-01-29
| | | | | | | | | | I had to stumble upon this feature before I realized it was here inside the tools directory all along. This documentation should make it easier for the next person coming along looking for a patchwork git hook. Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Make the post-receive hook more efficient (using pwclient info, not view)Carl Worth2014-01-29
| | | | | | | | | | | | | | Older versions of patchwork shipped with a version of pwclient that had the view command, but not info command. Now that info exists, it's inefficient to use it to obtain the patchwork ID value, (since it requires the server to send the entire patch content in response to an XML RPC request). So be kind to the server by using info instead, (which has a small, fixed-length response). Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tools/post-receive.hook: don't update the previously pushed commitCarl Worth2014-01-29
| | | | | | | | | | Previously, the post-receive hook would always examine one commit that had been previously pushed, (when the purpose of the hook is only to example newly-pushed commits). We fix this by simply dropping the '^' in the commit-range specification. Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: fix handling UTF-8 in patch infoAndreas Bießmann2014-01-28
| | | | | | | | | | | | | | | | | | | This patch fixes following error when redirecting 'pwclient info' output: ---8<--- andreas@dockstar % pwclient info 295268 > /tmp/test.out Traceback (most recent call last): File "/home/andreas/bin/pwclient", line 508, in <module> main() File "/home/andreas/bin/pwclient", line 471, in main action_info(rpc, patch_id) File "/home/andreas/bin/pwclient", line 242, in action_info print("- %- 14s: %s" % (key, value)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 29: ordinal not in range(128) --->8--- Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: We're targetting django 1.5 nowJeremy Kerr2013-10-13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add a config option to FORCE_HTTPS_LINKSKonstantin Ryabitsev2013-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | In situations where SSL is terminated at the load-balancer, we cannot rely on guessing the scheme based on whether patchwork itself was accessed via http or https, since the last-leg is always going to be done over http. Unfortunately, wrongly using http:// URLs results in unusable .pwclientrc files, since xmlrpc does not handle http->https redirects and instead displays a traceback. This change introduces a FORCE_HTTPS_LINKS option, which forces pwclientrc links to always return "https" regardless of how the project itself is accessed. It appears that the http/https check is currently only used for generating pwclientrc -- a lot of other places seem to hardcode "http://" and rely on the server to transparently upgrade the connection. This is not a secure approach (it allows for MITM and SSL-Strip attacks) and therefore all places currently hardcoding http://{{site.domain}} and similar should be switched to using the "sheme" variable, the same as done for generating pwclientrc files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/sql/migration: Fix column names for MySQL/MariaDBRalf Baechle2013-10-13
| | | | | | | | | | | | | | | | | The first issue is that patchwork was no longer accepting new patches via the apps/patchwork/bin/parsemail.sh script. When I was trying to invoke it manually, it only printed "no project found". I was able to figure out that this was caused by changes to the database scheme which are taken care of by the two SQL scripts: lib/sql/migration/012-project-add-columns.sql lib/sql/migration/013-bundle-names.sql The catch - these first script don't run with MySQL - or rather MariaDB that Fedora has switched to. MariaDB doesn't like the quotes around the table and column names. Patch below. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Use strings from fields module for error testsJeremy Kerr2013-10-13
| | | | | | | Rather than hard-coding expected error messages, grab the values from the fields module, and expose through the test utils. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Django 1.5 compatibility fixesRalf Baechle2013-10-13
| | | | | | | Django 1.5 wants plenty of quotes scattered over the templates. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Add support for rename-only patchesJeremy Kerr2013-10-13
| | | | | | | | | | | | | 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>
* views/base: Implement limit for submitter autocompletionJeremy Kerr2013-10-13
| | | | | | | Add a limit parameter to the completion view, and pass a limit of 20 results in the javascript. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/base: Include email addresses in submitter autocomplete searchJeremy Kerr2013-10-13
| | | | | | | | Currently, we only search names, which is a problem for Person objects with only an email address set. This change includes the email addresses in the search. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* docs: also mention that ROOT_DIR needs to be updatedFlorian Fainelli2013-10-04
| | | | | | | | | When the patchwork installation resides in the non-default location (/srv/patchwork) make sure that local_settings.py also gets updated with a proper ROOT_DIR value otherwise various problems will happen. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* sql: remove non-existing auth_message tableFlorian Fainelli2013-10-04
| | | | | | | | During a recent installation the grant-all MySQL script was erroring out because the "auth_message" table does not exist, remove it. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>