]> git.ozlabs.org Git - patchwork/log
patchwork
9 years agotemplates: display projects as inline-block elements
Jeremy Kerr [Wed, 7 May 2014 03:23:04 +0000 (11:23 +0800)]
templates: display projects as inline-block elements

... rather than one long list.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
9 years agomodels: order projects by linkname by default
Jeremy Kerr [Wed, 7 May 2014 02:07:57 +0000 (10:07 +0800)]
models: order projects by linkname by default

So we get a sensible list of projects on the front page's project list.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
9 years agotests: Add XMLRPC interface test
Jeremy Kerr [Wed, 7 May 2014 02:03:44 +0000 (10:03 +0800)]
tests: Add XMLRPC interface test

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>
9 years agourls: Fix django-1.6 change in password change views
Jeremy Kerr [Wed, 7 May 2014 01:06:15 +0000 (09:06 +0800)]
urls: Fix django-1.6 change in password change views

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>
9 years agoviews/xmlrpc: request.raw_post_data has been deprecated
Jeremy Kerr [Tue, 6 May 2014 23:48:35 +0000 (07:48 +0800)]
views/xmlrpc: request.raw_post_data has been deprecated

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
9 years agoutils/Order: Fix application of ordering
Jeremy Kerr [Thu, 24 Apr 2014 03:28:31 +0000 (11:28 +0800)]
utils/Order: Fix application of ordering

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>
9 years agodocs/INSTALL: Add setup details for patchwork cron script
Jeremy Kerr [Thu, 24 Apr 2014 01:52:07 +0000 (09:52 +0800)]
docs/INSTALL: Add setup details for patchwork cron script

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
9 years agotests: Make tests compatible with django 1.6
Jeremy Kerr [Wed, 23 Apr 2014 13:02:46 +0000 (21:02 +0800)]
tests: Make tests compatible with django 1.6

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>
9 years agoFix django-1.6 incompatibilities
Jeremy Kerr [Tue, 22 Apr 2014 13:19:52 +0000 (21:19 +0800)]
Fix django-1.6 incompatibilities

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>
10 years agotests/utils: Don't rely on field error message API
Jeremy Kerr [Tue, 22 Apr 2014 13:09:51 +0000 (21:09 +0800)]
tests/utils: Don't rely on field error message API

The location of EmailField's message changed in 1.6, just use a fixed
string instead.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotests/patchparser: Inherit from djagno.test.TestCase
Jeremy Kerr [Tue, 22 Apr 2014 13:03:05 +0000 (21:03 +0800)]
tests/patchparser: Inherit from djagno.test.TestCase

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>
10 years agolib/sql: remove references to auth_message model
Jeremy Kerr [Tue, 22 Apr 2014 12:50:19 +0000 (20:50 +0800)]
lib/sql: remove references to auth_message model

The Message model was deprecated in 1.4, and removed in 1.6

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoDefer Person creation/linkage until registration is confirmed
Jeremy Kerr [Tue, 22 Apr 2014 12:48:19 +0000 (20:48 +0800)]
Defer Person creation/linkage until registration is confirmed

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>
10 years agoAdd unconfirmed registration expiry
Jeremy Kerr [Tue, 22 Apr 2014 12:08:27 +0000 (20:08 +0800)]
Add unconfirmed registration expiry

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>
10 years agoUpdate manage.py to post a post-1.4 version.
Jeremy Kerr [Mon, 21 Apr 2014 03:06:37 +0000 (11:06 +0800)]
Update manage.py to post a post-1.4 version.

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>
10 years agoRemove references to django.conf.urls.defaults
Jeremy Kerr [Mon, 21 Apr 2014 02:56:32 +0000 (10:56 +0800)]
Remove references to django.conf.urls.defaults

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>
10 years agoviews/order: Apply default ordering as secondary
Jeremy Kerr [Wed, 12 Mar 2014 00:44:12 +0000 (08:44 +0800)]
views/order: Apply default ordering as secondary

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>
10 years agopost-receive: Fix error message when pushing to an unmapped branch
Carl Worth [Fri, 13 Dec 2013 04:28:02 +0000 (20:28 -0800)]
post-receive: Fix error message when pushing to an unmapped branch

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>
10 years agodocs: Add a pointer to the git post-receive hook
Carl Worth [Wed, 11 Dec 2013 18:46:28 +0000 (10:46 -0800)]
docs: Add a pointer to the git post-receive hook

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>
10 years agoMake the post-receive hook more efficient (using pwclient info, not view)
Carl Worth [Wed, 11 Dec 2013 18:46:27 +0000 (10:46 -0800)]
Make the post-receive hook more efficient (using pwclient info, not view)

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>
10 years agotools/post-receive.hook: don't update the previously pushed commit
Carl Worth [Wed, 11 Dec 2013 18:46:26 +0000 (10:46 -0800)]
tools/post-receive.hook: don't update the previously pushed commit

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>
10 years agopwclient: fix handling UTF-8 in patch info
Andreas Bießmann [Mon, 9 Dec 2013 12:30:53 +0000 (13:30 +0100)]
pwclient: fix handling UTF-8 in patch info

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>
10 years agodocs: We're targetting django 1.5 now
Jeremy Kerr [Sun, 13 Oct 2013 07:09:48 +0000 (15:09 +0800)]
docs: We're targetting django 1.5 now

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoAdd a config option to FORCE_HTTPS_LINKS
Konstantin Ryabitsev [Fri, 11 Oct 2013 14:47:30 +0000 (10:47 -0400)]
Add a config option to FORCE_HTTPS_LINKS

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>
10 years agolib/sql/migration: Fix column names for MySQL/MariaDB
Ralf Baechle [Mon, 29 Jul 2013 14:46:33 +0000 (16:46 +0200)]
lib/sql/migration: Fix column names for MySQL/MariaDB

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>
10 years agotests: Use strings from fields module for error tests
Jeremy Kerr [Sun, 13 Oct 2013 06:49:06 +0000 (14:49 +0800)]
tests: Use strings from fields module for error tests

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>
10 years agoDjango 1.5 compatibility fixes
Ralf Baechle [Thu, 3 Oct 2013 16:45:47 +0000 (18:45 +0200)]
Django 1.5 compatibility fixes

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>
10 years agoparser: Add support for rename-only patches
Jeremy Kerr [Sun, 13 Oct 2013 05:40:00 +0000 (13:40 +0800)]
parser: Add support for rename-only patches

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>
10 years agoviews/base: Implement limit for submitter autocompletion
Jeremy Kerr [Sun, 13 Oct 2013 05:04:31 +0000 (13:04 +0800)]
views/base: Implement limit for submitter autocompletion

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>
10 years agoviews/base: Include email addresses in submitter autocomplete search
Jeremy Kerr [Sun, 13 Oct 2013 04:48:21 +0000 (12:48 +0800)]
views/base: Include email addresses in submitter autocomplete search

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>
10 years agodocs: also mention that ROOT_DIR needs to be updated
Florian Fainelli [Tue, 1 Oct 2013 17:39:20 +0000 (18:39 +0100)]
docs: also mention that ROOT_DIR needs to be updated

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>
10 years agosql: remove non-existing auth_message table
Florian Fainelli [Tue, 1 Oct 2013 17:39:19 +0000 (18:39 +0100)]
sql: remove non-existing auth_message table

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>
10 years agodocs: fix INSTALL instructions regarding Django
Florian Fainelli [Tue, 1 Oct 2013 17:39:18 +0000 (18:39 +0100)]
docs: fix INSTALL instructions regarding Django

Django is no longer accessible using the old Subversion URL, update that
to the Github repository. Besides, the command-line used to perform the
"syncdb" operation does not work because we are off by one directory in
the filesystem, fix that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agosql: update grant-all.mysql.sql
Florian Fainelli [Tue, 1 Oct 2013 17:39:17 +0000 (18:39 +0100)]
sql: update grant-all.mysql.sql

The MySQL grant all script has a typo on the table
"patchwork_bundle_patches" vs "patchwork_bundlepatch" update that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodocs: update MySQL documentation bits
Florian Fainelli [Tue, 1 Oct 2013 17:39:16 +0000 (18:39 +0100)]
docs: update MySQL documentation bits

The MySQL documentation bits where missing a few important details for
installation setup to succeed like:

- having proper python-mysqldb support
- overriding the DATABASE_ENGINE to "mysql" for django to succeed in the
  "syncdb" operation

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agonotifications: add project name to patch update notification
Wolfram Sang [Fri, 17 May 2013 10:23:05 +0000 (12:23 +0200)]
notifications: add project name to patch update notification

Based on a feature request & patch from Wolfram Sang
<wsa@the-dreams.de>.

Notifications may span multiple projects, so include a summary in the
subject line, and detail in the header.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoDon't use total_seconds for python < 2.7
Konstantin Ryabitsev [Thu, 13 Jun 2013 14:50:56 +0000 (10:50 -0400)]
Don't use total_seconds for python < 2.7

The total_seconds function was added to datetime in python-2.7. For
compatibility with previous versions of python, use its suggested
equivalent (except drop microseconds, since we don't care about them in
this context).

Signed-off-by: Konstantin Ryabitsev <mricon@kernel.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agojs: Add jquery and jquery tablednd plugins
Jeremy Kerr [Sun, 16 Jun 2013 08:35:21 +0000 (16:35 +0800)]
js: Add jquery and jquery tablednd plugins

Based on a change from Andreas Bießmann <andreas@biessmann.de>.

Rather than requiring a download of the jquery library + tablednd
plugin, commit these to the repository.

In doing so, we upgrade to version 1.10.1 of jqeury, and the current
stable tablednd.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotest/mboxviews: Add test for header-supplied dates
Jeremy Kerr [Mon, 10 Jun 2013 04:29:34 +0000 (12:29 +0800)]
test/mboxviews: Add test for header-supplied dates

Check that a Date: header in the original message is equivalent to the
header generated in the mbox output.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoviews/mbox: Use Date: header from original message
Jeremy Kerr [Mon, 10 Jun 2013 03:50:21 +0000 (11:50 +0800)]
views/mbox: Use Date: header from original message

Since we use UTC for internal date storage, we lose the timestamp info
from the original patch submissions. This means that the mbox views
(which are typically passed through to SCM commit logs) lose the
timezone information.

This change uses the Date header from the original message, if possible.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoviews: Move mbox handling from models to views
Jeremy Kerr [Mon, 10 Jun 2013 03:37:25 +0000 (11:37 +0800)]
views: Move mbox handling from models to views

Mbox generation is related to views, not the models themselves. This
change creates a patch_to_mbox function in the views/ directory, which
the actual view handlers use instead of Patch.mbox().

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agomodels: Fix invalid dates in patch mbox
Jeremy Kerr [Mon, 10 Jun 2013 02:16:24 +0000 (10:16 +0800)]
models: Fix invalid dates in patch mbox

Currently, the Date header in mbox views is incorrect;
datetime.datetime.utctimetuple assumes that the date is in the local
timezone, but we keep all dates as UTC.

This change replaces utctimetuple with a manual calculation of the
seconds-since-epoch timestamp, which email.utils.formatdate requires. We
add a testcase for this too.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agomodels: fix From header in mbox view
Andreas Bießmann [Fri, 10 May 2013 00:44:26 +0000 (00:44 +0000)]
models: fix From header in mbox view

The From header in mbox view was corrupt for patch submitters with non-ASCII
characters in their names. RFC 2822 requires to retain the mail as ASCII in
braces '<' and '>' while the name should be coded. Before we coded the whole
string which led to some MUA misinterpret the From header (while git could
manage it).
Fix this by coding just the name and let the email untouched.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agotests/mboxviews: add test for correct From header
Andreas Bießmann [Fri, 10 May 2013 00:44:25 +0000 (00:44 +0000)]
tests/mboxviews: add test for correct From header

Currently we produce corrupted 'From' header in mbox output when senders name
contains non ASCII characters. Provide a test to show this issue.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agobundles: Don't display 'Change order' button on public bundle view
Jeremy Kerr [Sun, 21 Apr 2013 06:50:46 +0000 (14:50 +0800)]
bundles: Don't display 'Change order' button on public bundle view

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agobundles: Don't allow slashes in bundle names
Jeremy Kerr [Sat, 20 Apr 2013 14:34:28 +0000 (22:34 +0800)]
bundles: Don't allow slashes in bundle names

Because bundle names are used in URLs, we don't want slashes in them.

Include a SQL migration script.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agobundles: Remove separate public bundle views
Jeremy Kerr [Sat, 20 Apr 2013 13:45:40 +0000 (21:45 +0800)]
bundles: Remove separate public bundle views

Having two views for bundles (public and non-public) can cause confusion
when bundle owners want to share a URL; it's not obvious that the
private URL isn't shareable.

This change removes the private URLs, and puts all bundles under the
/bundle/<username>/<bundlename>/ URL space. For non-public bundles, this
will just 404 for non-owners.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoforms: Only pass post data to multiplepatchform if that was what was submitted
Jeremy Kerr [Sun, 30 Dec 2012 05:57:18 +0000 (13:57 +0800)]
forms: Only pass post data to multiplepatchform if that was what was submitted

When updating bundles, we get a spurious error message in the
MultiplePatchForm; it's performing validation on the blank form data.

This change only passes the post data to the MuliplePatchForm if we
detect (through data['form']) that it was the MultiplePatchForm that was
submitted.

This fixes the current testsuite failure.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/bundle: Check for form errors during bundle updates
Jeremy Kerr [Sun, 30 Dec 2012 05:31:08 +0000 (13:31 +0800)]
tests/bundle: Check for form errors during bundle updates

Add a check for patchform errors during bundle update operations, both
when logged in as a maintainer and a regular user.

This exposes a problem with the maintainer patchform: we see an
unexpected form error with the state input.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/bundle: Add bundle update tests, fix missing action behaviour
Jeremy Kerr [Sun, 30 Dec 2012 05:21:01 +0000 (13:21 +0800)]
tests/bundle: Add bundle update tests, fix missing action behaviour

Add a couple of tests for the bundle update views. This exposes a
problem with no action is specified, so fix this too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotemplates/bundle: Unify public bundle meta information
Jeremy Kerr [Sun, 30 Dec 2012 04:31:50 +0000 (12:31 +0800)]
templates/bundle: Unify public bundle meta information

Currently, the public bundle meta information (the download link before
the list of patches) differs from that of the private bundle view. This
change unifies this information with the private view.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/bundle: Add tests for public bundle views
Jeremy Kerr [Sun, 30 Dec 2012 04:15:25 +0000 (12:15 +0800)]
tests/bundle: Add tests for public bundle views

Ensure that public bundles are accessible, and that private ones are
not.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoviews/bundle: Allow downloading public bundle as mbox
Simo Sorce [Tue, 6 Nov 2012 17:45:08 +0000 (17:45 +0000)]
views/bundle: Allow downloading public bundle as mbox

Downloading single patches anonymously is allowed, we may as well allow
downloading public bundles as mboxes.

This patch also changes the file name to be bundle-<id>-<name>.mbox so
that the file name is unique even if bundle names are reused.

Signed-off-by: Simo Sorce <idra@samba.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agopwclient: Add a little more space in 'pwclient list'
Doug Anderson [Mon, 3 Dec 2012 14:13:41 +0000 (14:13 +0000)]
pwclient: Add a little more space in 'pwclient list'

New patch IDs are now 7 digits long on patchwork.kernel.org.  Give a
little more space.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoxmlrpc: Avoid trying to marshall None for people with no name
Doug Anderson [Fri, 21 Dec 2012 13:42:43 +0000 (13:42 +0000)]
xmlrpc: Avoid trying to marshall None for people with no name

If a person sent patches with no real name, they may have None for
their name.  In this case just use their email address as their name.

The previous pwclient error that would show up looks like:

  $ pwclient list -w anonymous@example.com
  Traceback (most recent call last):
    File ".../pwclient", line 631, in <module>
      main()
    File ".../pwclient", line 570, in main
      action_list(rpc, filt, submitter_str, delegate_str, series_str)
    File ".../pwclient", line 316, in action_list
      ids = person_ids_by_name(rpc, submitter_str)
    File ".../pwclient", line 241, in person_ids_by_name
      people = rpc.person_list(name, 0)
    File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
      return self.__send(self.__name, args)
    File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
      verbose=self.__verbose
    File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
      return self.single_request(host, handler, request_body, verbose)
    File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request
      return self.parse_response(response)
    File "/usr/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
      return u.close()
    File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close
      raise Fault(**self._stack[0])
  xmlrpclib.Fault: <Fault 1: "<type 'exceptions.TypeError'>:cannot marshal None unless allow_none is enabled">

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agopwclient: Add command for printing patch info
Doug Anderson [Mon, 3 Dec 2012 14:08:17 +0000 (14:08 +0000)]
pwclient: Add command for printing patch info

This command prints raw information that patchwork has about a patch.  This can
be useful for debugging problems with patchwork.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotemplates: patchwork project URL fixes
Jeremy Kerr [Thu, 29 Nov 2012 00:40:19 +0000 (08:40 +0800)]
templates: patchwork project URL fixes

We need a trailing slash, and to update the URL in the about page too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotemplates: Update patchwork project URL
Jeremy Kerr [Tue, 6 Nov 2012 08:37:37 +0000 (16:37 +0800)]
templates: Update patchwork project URL

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotemplates: Add link to the projects website in the projects view
Simo Sorce [Fri, 26 Oct 2012 12:51:43 +0000 (12:51 +0000)]
templates: Add link to the projects website in the projects view

Allows the casual visitor to check out what all these projects
actually are.

Signed-off-by: Simo Sorce <idra@samba.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoAdd URL and SCM data to projects
Simo Sorce [Fri, 26 Oct 2012 12:51:42 +0000 (12:51 +0000)]
Add URL and SCM data to projects

This allows us to display friendly links to the project website,
web SCM UI and SCM URL.

For example for the patchwork project these could be set to:
web_url: http://jk.ozlabs.org/projects/patchwork/
scm_url: git://ozlabs.org/home/jk/git/patchwork
webscm_url: http://git.ozlabs.org/?p=patchwork;a=tree

Requires a DB schema upgrade

Signed-off-by: Simo Sorce <idra@samba.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoAdd shortcut to admin panel
Simo Sorce [Wed, 24 Oct 2012 19:08:43 +0000 (19:08 +0000)]
Add shortcut to admin panel

This patch adds a shortcut to the admin panel but only for users that
are members of staff.

Signed-off-by: Simo Sorce <idra@samba.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agopwclient: lookup patch_id given Message-Id
Ben Myers [Mon, 5 Nov 2012 13:15:01 +0000 (21:15 +0800)]
pwclient: lookup patch_id given Message-Id

Add a pwclient search option '-m' to look up a patch id given a
Message-id. This is useful for automation and mailer hooks.

Signed-off-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoFix grant script
Simo Sorce [Wed, 24 Oct 2012 22:07:00 +0000 (18:07 -0400)]
Fix grant script

patchwork_patchchangenotification_id_seq does not exist,
so running this script simply fails with a rollback

Signed-off-by: Simo Sorce <idra@samba.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agobundles: Add check for duplicate bundles
Jeremy Kerr [Mon, 22 Oct 2012 04:19:27 +0000 (12:19 +0800)]
bundles: Add check for duplicate bundles

... rather than failing with an IntegrityError.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agorequestcontext: Initialise 'messages' context var
Jeremy Kerr [Sun, 17 Jun 2012 07:39:21 +0000 (15:39 +0800)]
requestcontext: Initialise 'messages' context var

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agosettings: Use new class for auth context processor
Jeremy Kerr [Sun, 17 Jun 2012 07:38:22 +0000 (15:38 +0800)]
settings: Use new class for auth context processor

Since django 1.2 auth module is in contrib, not core.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agosettings: Use class-based template loading API
Jeremy Kerr [Sun, 17 Jun 2012 07:36:41 +0000 (15:36 +0800)]
settings: Use class-based template loading API

The TEMPLATE_LOADERS setting changed in django-1.2. Template loaders are
now based on calsses rather than callables.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agosettings: Add message middleware
Jeremy Kerr [Thu, 6 Sep 2012 01:12:56 +0000 (09:12 +0800)]
settings: Add message middleware

This seems to be required for admin updates.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agopwclient: Pass input to git-am as a UTF-8 string
Jeremy Kerr [Tue, 4 Sep 2012 00:28:03 +0000 (08:28 +0800)]
pwclient: Pass input to git-am as a UTF-8 string

.. to prevent ascii codec exceptions.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotemplates: Don't rely on bool(Page)
Jeremy Kerr [Sun, 17 Jun 2012 08:06:37 +0000 (16:06 +0800)]
templates: Don't rely on bool(Page)

The behaviour of bool(Page) changed in django 1.4 - it no longer
evaluates to False when page has no objects.

When checking for an empty patch list, use page.paginator.count.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agomodels: Add connection parameter for HashField.db_type.
Jeremy Kerr [Fri, 4 May 2012 01:52:23 +0000 (09:52 +0800)]
models: Add connection parameter for HashField.db_type.

This is required by django-1.4.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests: Find test data relative to file location
Dirk Wallenstein [Thu, 3 May 2012 02:45:39 +0000 (02:45 +0000)]
tests: Find test data relative to file location

Make test execution independent of the current directory.

Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/notifications: Add test for escaped patch names
Jeremy Kerr [Tue, 1 May 2012 07:51:38 +0000 (15:51 +0800)]
tests/notifications: Add test for escaped patch names

.. to test for the fix introduced in 18986b7e.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agonotifications: do not HTML-escape patch change notifications
Stefan Hajnoczi [Sun, 15 Jan 2012 09:49:24 +0000 (09:49 +0000)]
notifications: do not HTML-escape patch change notifications

Patch change notifications are text/plain emails and should not
HTML-escape patch names.  This means quotes and ampersands in patch
names should not be turned into &quot; and &amp; HTML entities.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests: Check the right optin email
Dirk Wallenstein [Mon, 30 Apr 2012 09:17:55 +0000 (09:17 +0000)]
tests: Check the right optin email

Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/patchparser: abstract delegate and state testing
Jeremy Kerr [Mon, 30 Apr 2012 06:40:15 +0000 (14:40 +0800)]
tests/patchparser: abstract delegate and state testing

No need to repeat the same query logic.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests/patchparser: don't assume PK values
Jeremy Kerr [Mon, 30 Apr 2012 06:34:48 +0000 (14:34 +0800)]
tests/patchparser: don't assume PK values

PK values may not start at 1 for each test, so remove filters that
assume this.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agotests: Add tests for explicit delegate and state requests
Dirk Wallenstein [Sun, 29 Apr 2012 03:11:49 +0000 (03:11 +0000)]
tests: Add tests for explicit delegate and state requests

Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11 years agoUse an explicit initial default patch state
Dirk Wallenstein [Sun, 29 Apr 2012 03:11:48 +0000 (03:11 +0000)]
Use an explicit initial default patch state

This will make editing states through the admin UI less error-prone, and
will facilitate parsing patches when relying on a default state, as well as
testing.

Use the explicit default state when parsing mails.

Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agoparser: allow words starting with "diff" at beginning of line
Stefan Hajnoczi [Sat, 14 Jan 2012 01:17:40 +0000 (01:17 +0000)]
parser: allow words starting with "diff" at beginning of line

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>
12 years agosql: remove development migration script
Jeremy Kerr [Thu, 8 Dec 2011 14:28:22 +0000 (22:28 +0800)]
sql: remove development migration script

The projectmaintainer heirachy hasn't been implemented, so we don't need
the migration script yet.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agotests/patchparser: Add CVS format patch test
Jeremy Kerr [Thu, 8 Dec 2011 14:07:28 +0000 (22:07 +0800)]
tests/patchparser: Add CVS format patch test

Test that CVS-formatted patches are parsed correctly, and that we
capture the correct 'Index: ' metadata.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agotests: add abstract mbox parsing test
Jeremy Kerr [Thu, 8 Dec 2011 14:00:43 +0000 (22:00 +0800)]
tests: add abstract mbox parsing test

Add a new class to handle mbox-parsing code, abstracting what is done by
the current git-pull tests.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agofilters: handle utf-8 characters when building filter querystring
Jeremy Kerr [Thu, 8 Dec 2011 13:42:26 +0000 (21:42 +0800)]
filters: handle utf-8 characters when building filter querystring

Currently, we build the filter querystring by passing the raw string to
urllib.quote, which expects an encoded string. When the raw string (in
this case, a unicode object) contains a unicode character, quote()
raises a KeyError.

This fixes the problem by encoding the parameter name and values to
UTF-8 first.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agopatchwork: new pwclient git-am action
david decotigny [Tue, 22 Nov 2011 09:12:48 +0000 (09:12 +0000)]
patchwork: new pwclient git-am action

This commit adds a new "pwclient git-am" action which applies given
patch ID on the current git branch using "git am". It's convenient to
keep track and authorship of patches applied locally from a patchwork
server.

Signed-off-by: David Decotigny <david.decotigny@google.com>
12 years agoparser: allow other protocol types in pull-request handling
Jeremy Kerr [Fri, 25 Nov 2011 09:55:19 +0000 (17:55 +0800)]
parser: allow other protocol types in pull-request handling

Change the parser's regex to allow other protocol types, not just git://

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agomodels: Update Person & UserProfile object whenever User is saved
Jeremy Kerr [Mon, 19 Sep 2011 02:33:51 +0000 (10:33 +0800)]
models: Update Person & UserProfile object whenever User is saved

Currently, UserProfiles are only saved on creation of the User object,
before the first_name and last_name attributes are set. This means that
we fallback to using the User.username value as the new Person.name.

This change modifies User's post-save signal to always update the Person
object, both on creation and updates. This means we get the proper name
appearing on Person instances.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 years agoMerge branch 'notifications'
Jeremy Kerr [Mon, 19 Sep 2011 01:42:44 +0000 (09:42 +0800)]
Merge branch 'notifications'

12 years agoxmlrpc: do slice before patch_to_dict
Jeremy Kerr [Mon, 18 Jul 2011 13:46:08 +0000 (21:46 +0800)]
xmlrpc: do slice before patch_to_dict

Currently, we map patch_to_dict before we slice the results (to only
return max_count patches). This means that we hacve to retrieve all
patches, then throw away most of the results of the map.

This change does the slice on the patches before the map, letting django
do a LIMIT-ed query instead.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agosettings: Use multiple-DB-style format for default settings
Jeremy Kerr [Tue, 19 Apr 2011 05:18:45 +0000 (13:18 +0800)]
settings: Use multiple-DB-style format for default settings

The DATABASE_* settings have been deprecated in django 1.3, replaced by
the multiple-database style format (introduced in 1.2, which patchwork
requires anyway).

This change modifies the default settings.py to use the new format.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoPatchwork now requires Django 1.2, so state that in docs/INSTALL
Guilherme Salgado [Thu, 14 Apr 2011 04:16:36 +0000 (04:16 +0000)]
Patchwork now requires Django 1.2, so state that in docs/INSTALL

Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoOrder: always set Order.order
Jeremy Kerr [Tue, 19 Apr 2011 05:09:36 +0000 (13:09 +0800)]
Order: always set Order.order

If we create an Order objecty with editable = True, we don't initialise
self.order, leading to testsuite failures with django-1.3.

This change always initialises Order.order (and Order.reversed), so we
don't exit the constructor without these initalised.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agonotifications: implement opt-out notifications
Jeremy Kerr [Thu, 14 Apr 2011 11:37:55 +0000 (19:37 +0800)]
notifications: implement opt-out

Check for opt-out status before sending notification mail.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agonotifications: Add NOTIFICATION_FROM_EMAIL setting
Jeremy Kerr [Thu, 14 Apr 2011 03:25:47 +0000 (11:25 +0800)]
notifications: Add NOTIFICATION_FROM_EMAIL setting

Allow a separate From: address for notificaton emails.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agonotifications: Add code to send notifications
Jeremy Kerr [Tue, 29 Mar 2011 14:18:54 +0000 (22:18 +0800)]
notifications: Add code to send notifications

Add a function (patchwork.utils.send_notifications) to process the
PatchChangeNotification queue. We try to group mail to the same sender,
by waiting settings.NOTIFICATION_DELAY_MINUTES to allow other
notifications to arrive.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agomodels: Add PatchChangeNotification and record patch state changes
Jeremy Kerr [Tue, 29 Mar 2011 03:58:39 +0000 (11:58 +0800)]
models: Add PatchChangeNotification and record patch state changes

Add a PatchChangeNotification model to keep track of changes to a
patch's state. Hook this up to Patch's pre_save signal.

Requires a DB schema upgrade.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoAdd email opt-out system
Jeremy Kerr [Wed, 11 Aug 2010 06:16:28 +0000 (14:16 +0800)]
Add email opt-out system

We're going to start generating emails on patchwork updates, so firstly
allow people to opt-out of all patchwork communications.

We do this with a 'mail settings' interface, allowing non-registered
users to set preferences on their email address. Logged-in users can do
this through the user profile view.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoregistration: use EmailConfimation rather than separate registration app
Jeremy Kerr [Sun, 31 Oct 2010 23:29:29 +0000 (19:29 -0400)]
registration: use EmailConfimation rather than separate registration app

Since we have infrastructure for email confirmations, we no longer need
the separate registration app.

Requires a migration script, which will delete all inactive users,
including those newly added and pending confirmation. Use carefully.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoUse generic email confirmation object
Jeremy Kerr [Thu, 12 Aug 2010 04:15:48 +0000 (12:15 +0800)]
Use generic email confirmation object

Rather than having a UserPerson-specific confirmation, add an
EmailConfirmation object to allow multiple types of confirmations (eg,
opt-out requests in future).

To do this, we use a view (patchwork.views.confirm) that will call the
type-specific view with the confirmation object.

Also, add tests to check that the User/Person linkage system works.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
13 years agoforms: Fix MultipleBooleanField.to_python when the field value is missing
Guilherme Salgado [Wed, 13 Apr 2011 06:11:07 +0000 (06:11 +0000)]
forms: Fix MultipleBooleanField.to_python when the field value is missing

If you write a test for, say, the bundle form of a patch list, you'd
still have to specify the 'no change' value to other form (e.g. the
multiple update one) fields using MultipleBooleanField or else it'd
raise a ValueError when field.clean() is called as part of
form._get_errors().

Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>