]> git.ipfire.org Git - thirdparty/patchwork.git/log
thirdparty/patchwork.git
10 years agotemplates: Move "About" at the bottom of the page
Belén Barros Peña [Tue, 9 Sep 2014 15:01:05 +0000 (16:01 +0100)] 
templates: Move "About" at the bottom of the page

This is part of the steps needed to make the "nav" bar into a pure
breadcrumb trail. It's quite usual these days to have "about" style
links at the bottom of pages.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Belén Barros Peña <belen.barros.pena@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotemplates: Redesign the breadcrumbs bar
Damien Lespiau [Tue, 9 Sep 2014 14:32:35 +0000 (15:32 +0100)] 
templates: Redesign the breadcrumbs bar

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotemplates: Redesign the title bar
Damien Lespiau [Tue, 9 Sep 2014 13:22:25 +0000 (14:22 +0100)] 
templates: Redesign the title bar

Let's use HTML5 <nav> and bootstrap navigation facilities for this.

Among the nice things that bootstrap brings to the table, the navigation
bar is now mobile friendly: it will collapse when either, being
displayed on a mobile device or when the screen isn't wide enough, to
show the various items in a togglable menu. This can be tested by
resizing the browser to have a width < 768px.

This commit is just about layout changes, keeping the exact same
information displayed on the page.

This is based on work from Belén Barros Peña, but transposed to
bootstrap.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agostyle.css: Tune <a> styling
Belén Barros Peña [Thu, 9 Oct 2014 09:09:05 +0000 (10:09 +0100)] 
style.css: Tune <a> styling

The links aren't underlined anymore. If, once visited, they are to
become black, we won't be able to distinguish them from regular text.

Instead let's decide about a color for links so they can be spotted,
even after a visit.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agostyle.css: Move the global <a> styling at the top
Damien Lespiau [Tue, 9 Sep 2014 13:16:10 +0000 (14:16 +0100)] 
style.css: Move the global <a> styling at the top

Otherwise we can't properly have a generic <a> styling that gets
specialized as needed.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agosytle.css: Remove the body selector, letting bootstrap's shine through
Damien Lespiau [Sun, 7 Sep 2014 16:01:45 +0000 (17:01 +0100)] 
sytle.css: Remove the body selector, letting bootstrap's shine through

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agolist: Replace the 16-arrow* icons by glyphicons
Damien Lespiau [Sun, 31 Aug 2014 23:06:41 +0000 (00:06 +0100)] 
list: Replace the 16-arrow* icons by glyphicons

They look more modern.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotemplate: Add bootstrap to the base template
Damien Lespiau [Sun, 31 Aug 2014 21:42:24 +0000 (22:42 +0100)] 
template: Add bootstrap to the base template

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agohtdocs: Add bootstrap
Damien Lespiau [Sun, 31 Aug 2014 21:40:20 +0000 (22:40 +0100)] 
htdocs: Add bootstrap

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agosettings: Also define SERVER_EMAIL for email logs
Damien Lespiau [Sat, 26 Sep 2015 09:56:36 +0000 (10:56 +0100)] 
settings: Also define SERVER_EMAIL for email logs

Django can send emails to admins on 500 HTTP errors when DEBUG is false.
That looks handy. That mechanism uses SERVER_EMAIL for the From:
address, which defaults to root@localhost and can cause problems in the
email delivery.

Use the same address than DEFAULT_FROM_EMAIL by default.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agosettings: Move DEFAULT_FROM_EMAIL to the core settings section
Damien Lespiau [Sat, 26 Sep 2015 09:50:49 +0000 (10:50 +0100)] 
settings: Move DEFAULT_FROM_EMAIL to the core settings section

DEFAULT_FROM_EMAIL is actually a django setting, not a patchwork one.

v2: Capitalize the 'E' of 'Email' (Stephen Finucane)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoviews: patch-list: show the 'Properties' update box for all users
Brian Norris [Sun, 23 Nov 2014 06:30:06 +0000 (22:30 -0800)] 
views: patch-list: show the 'Properties' update box for all users

Any authenticated user should be able to change the properties of their
own patches from the list view. They can already do so from the patch
view and from pwclient.

Now, authenticated users can perform 'Change state', 'Delegate to', and
'Archive' operations on multiple patches at a time (e.g., after
'select-all' on a bundle, or after selecting a few patches
individually). We'll print an error message to the page for any patches
which can't be updated (e.g., due to ownership).

This fixes a usability issue that has been reported a few times.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoparsemail: Don't catch exceptions when saving patches and comments
Damien Lespiau [Fri, 9 Oct 2015 10:22:54 +0000 (11:22 +0100)] 
parsemail: Don't catch exceptions when saving patches and comments

We'd like to know when those operations fail in production so we can at
least inspect what happened through the email send to settings.ADMINS in
main().

Catching those exceptions early prevents that.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotests: Fix a typo in the MboxPassThroughHeaderTest description
Damien Lespiau [Fri, 9 Oct 2015 10:17:02 +0000 (11:17 +0100)] 
tests: Fix a typo in the MboxPassThroughHeaderTest description

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agogitignore: Explicitly ignore dirs in lib/packages
Damien Lespiau [Fri, 9 Oct 2015 10:17:01 +0000 (11:17 +0100)] 
gitignore: Explicitly ignore dirs in lib/packages

This file ignores everything at the moment. This doesn't look like a
good idea, there are also jquery files there.

We ignore django/ because installing django there is what currently is
documented to do.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agogitignore: Only ignore quilt files at the root of the repository
Damien Lespiau [Fri, 9 Oct 2015 10:17:00 +0000 (11:17 +0100)] 
gitignore: Only ignore quilt files at the root of the repository

So, say, a 'series' directory in the project (added in a later patch)
doesn't get ignored.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agowsgi.conf: Fix the path in the Directory directive
Damien Lespiau [Fri, 9 Oct 2015 15:47:19 +0000 (16:47 +0100)] 
wsgi.conf: Fix the path in the Directory directive

The path in <Directory> didn't match the one defined in Alias.

While at it, remove the unnecessary quotes.

Reported-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agodocs: Add basic API guide
Stephen Finucane [Sat, 10 Oct 2015 03:05:27 +0000 (04:05 +0100)] 
docs: Add basic API guide

Because it is now possible to access the auto-generated XML-RPC
documentation, only provide a brief "HOWTO" on using the 'xmlrpclib'
library and a note on how to find this autogenerated documentation.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoviews/xmlrpc: Remove unneeded '""' parameters
Stephen Finucane [Mon, 12 Oct 2015 16:34:50 +0000 (11:34 -0500)] 
views/xmlrpc: Remove unneeded '""' parameters

These don't make semantic sense: if a user didn't provide a parameter
then we should check for None.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoviews/xmlrpc: Add serialization documentation
Stephen Finucane [Mon, 12 Oct 2015 17:01:55 +0000 (12:01 -0500)] 
views/xmlrpc: Add serialization documentation

Add some documentation for the XML-RPC serializers, including examples.
This will help developers understand exactly what the API *should* be
returning for each given method.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoviews/xmlrpc: Add documentation for API methods
Stephen Finucane [Mon, 12 Oct 2015 16:20:10 +0000 (11:20 -0500)] 
views/xmlrpc: Add documentation for API methods

This will be useful for populating the XML-RPC API documentation.

Note that this uses the Google-style docstring format. This format is
easier to read than the information-dense, "classic" Sphinx docstring
format making it more suitable for use with pydoc (which does not do
any post-processing and it used by the 'DocXMLRPCServer' module). If
generating documentation using Sphinx, this will require the usage of
the 'sphinx.ext.napoleon' extension.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoviews/xmlrpc: Add xmlrpc automatic documentation
Stephen Finucane [Sat, 10 Oct 2015 02:50:53 +0000 (03:50 +0100)] 
views/xmlrpc: Add xmlrpc automatic documentation

The DocXMLRPCServer module (standard library) provides documentation
for XML-RPC dispatchers via pydoc. Use this module rather than
reinventing the wheel.

Also update a test that no longer makes sense (the GET method now
retrieves documentation - it shouldn't redirect. Use PATCH instead).

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotrivial: Clean up 'views/xmlrpc.py'
Stephen Finucane [Mon, 29 Jun 2015 20:57:18 +0000 (21:57 +0100)] 
trivial: Clean up 'views/xmlrpc.py'

Resolve some issues with the aforementioned file. These are mostly
stylistic changes.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
10 years agoparsemail: Mail error information to ADMINS when parsing fails
Damien Lespiau [Thu, 1 Oct 2015 11:35:20 +0000 (12:35 +0100)] 
parsemail: Mail error information to ADMINS when parsing fails

We can use the built-in mechanism from django to send error emails when
failing to parse a mail. The error mails will have contain the full
guitly mail and the corresponding backtrace for debugging purposes.

v2: Add 2 PEP8 blank lines (Stephen Finucane)
v3: Remove one blank line (Stephen Finucane)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agoflake: Restrict flake to the patchwork directory
Damien Lespiau [Tue, 22 Sep 2015 15:09:10 +0000 (16:09 +0100)] 
flake: Restrict flake to the patchwork directory

Right now flake will inspect everything in the root directory. We can
avoid a bit of work, telling it to only look at the patchwork/
directory.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotox: Omit tests and manage.py when running coverage tests
Damien Lespiau [Tue, 22 Sep 2015 14:59:33 +0000 (15:59 +0100)] 
tox: Omit tests and manage.py when running coverage tests

Having the tests in the coverage reports artifically improve the
coverage percentage, because every line in tests is being run.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agodocs: Update Git URLs to GitHub v1.0.0
Stephen Finucane [Fri, 16 Oct 2015 21:45:38 +0000 (22:45 +0100)] 
docs: Update Git URLs to GitHub

Per move to GitHub:

    https://lists.ozlabs.org/pipermail/patchwork/2015-October/001873.html

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agodoc: Add CHANGELOG and UPGRADING docs
Stephen Finucane [Fri, 16 Oct 2015 19:29:53 +0000 (20:29 +0100)] 
doc: Add CHANGELOG and UPGRADING docs

The CHANGELOG document should describe the high level changes of the
project. This will provide a human-readable way for people to evaluate
the changes in each release. This file is based on the templates and
general changelog "ethos" provided by 'Keep a CHANGELOG':

    http://keepachangelog.com/

The UPGRADING document provide instruction for system admininstrators
managing patchwork deployments. At the moment, this document is a
rename and minor reformatting of the existing 'docs/NEWS' document, but
going forward documentation will be added for each new release.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agopwclient: use argparse's error() function for bad input
Brian Norris [Fri, 16 Oct 2015 23:39:03 +0000 (16:39 -0700)] 
pwclient: use argparse's error() function for bad input

This reduces the boilerplate we need and provides a more consistent help
output. e.g.:

   $ pwclient update -s FOO -c 1337 314159 1234567
   usage: pwclient update [--help] [-h HASH] [-p PROJECT] [-c COMMIT-REF]
                          [-s STATE] [-a {yes,no}]
                          [ID [ID ...]]
   pwclient update: error: Declining update with COMMIT-REF on multiple IDs

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agopwclient: rework multi-command help text
Brian Norris [Fri, 16 Oct 2015 23:39:02 +0000 (16:39 -0700)] 
pwclient: rework multi-command help text

Our --help handling is convoluted and confusing, since we're hacking
around using some of argparse's built-in features (like generating
--help arguments for us). It seems like we were hacking around the
conflict between -h used for hashes and -h used for automatic help
flags. Fortunately, Python's argparse provides us with a
'conflict_handler' which will resolve these conflicts for us.

Altogether, this patch means that 'pwclient --help' will not generate a
full recursive print of all subcommand helps (arguably a good thing),
but it provides better automatic formatting of all the supported
subcommands and eliminates some awkward code.

Sample runs:

$ pwclient
usage: pwclient [-h]
                {apply,git-am,get,info,projects,states,view,update,list,search}
                ...

optional arguments:
  -h, --help            show this help message and exit

Commands:
  {apply,git-am,get,info,projects,states,view,update,list,search}
    apply               Apply a patch (in the current dir, using -p1)
    git-am              Apply a patch to current git branch using "git am".
    get                 Download a patch and save it locally
    info                Display patchwork info about a given patch ID
    projects            List all projects
    states              Show list of potential patch states
    view                View a patch
    update              Update patch
    list                List patches, using the optional filters specified
                        below and an optional substring to search for patches
                        by name
    search              Alias for "list"

Use 'pwclient <command> --help' for more info

$ pwclient info --help
usage: pwclient info [--help] [-h HASH] [-p PROJECT] [ID [ID ...]]

positional arguments:
  ID          Patch ID

optional arguments:
  --help      show this help message and exit
  -h HASH     Lookup by patch hash
  -p PROJECT  Lookup patch in project

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agopwclient: require one or more of pwclient -{a,s}
Brian Norris [Fri, 16 Oct 2015 23:39:01 +0000 (16:39 -0700)] 
pwclient: require one or more of pwclient -{a,s}

Previously, we required the -s flag for 'pwclient update'. But since we
allow updating up to 2 different fields ('archived' and 'state'), drop
the required flag, and just enforce that the user must provide -a, -s,
or both.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agopwclient: dict.iteritems() is deprecated in Python 3
Brian Norris [Fri, 16 Oct 2015 23:39:00 +0000 (16:39 -0700)] 
pwclient: dict.iteritems() is deprecated in Python 3

Just use dict.items(), since there are few fields and we don't really
care about the extra copying.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agopwclient: basic python3 support
Mike Frysinger [Fri, 16 Oct 2015 21:15:31 +0000 (17:15 -0400)] 
pwclient: basic python3 support

This fixes a few random issues to make the script work at least somewhat
under python 3:
- set the default encoding to utf-8
- handle xmlrpclib/xmlrpc.client module renames
- handle ConfigParser/configparser module renames
- add a unicode() stub for python 3
- fix old style class definition w/Filter
- use list comprehension instead of map()
- drop the unused version= keyword w/argparse

The code still runs under python 2 the same as before, and now works for
the most part under python 3 -- the handling of encoded content still needs
some work, but that'll require more surgery, and is best left to another
commit after this.

Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@hotmail.com>
10 years agopwclient: use print_function for better py3 compatibility
Mike Frysinger [Fri, 16 Oct 2015 21:15:30 +0000 (17:15 -0400)] 
pwclient: use print_function for better py3 compatibility

The script already tries to use print like a function in many places but
is really passing a parenthesized string.  Import the print_function from
the future module so that it actually works as intended.

We also need to fix up a few latent print statements to make it work.

Signed-off-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Stephen Finucane <stephen.finucane@hotmail.com>
10 years agopwclient: handle missing ~/.pwclientrc better
Mike Frysinger [Fri, 16 Oct 2015 21:15:29 +0000 (17:15 -0400)] 
pwclient: handle missing ~/.pwclientrc better

The upgrade path will crash if ~/.pwclientrc doesn't exist, so add an
explicit check for the file before we try to "upgrade" it.

The default error messages don't mention the config file, so it can be
a bit confusing what pwclient is complaining about when running.

Signed-off-by: Mike Frysinger <vapier@chromium.org>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Stephen Finucane <stephen.finucane@hotmail.com>
10 years agoHighlight patches with Acked/Reviewed/Tested tags
Thomas Petazzoni [Mon, 20 Jul 2015 09:30:59 +0000 (11:30 +0200)] 
Highlight patches with Acked/Reviewed/Tested tags

A little while ago, accounting of the number of Acked-by, Reviewed-by
and Tested-by tags was added to patchwork. The count of such tags per
patch is shown in the "A / R / T" column.

However, since the values are shown for all patches regardless of
whether they are zero or not, it makes it not very easy to spot the
patches that have at least one Acked-by, Tested-by or Reviewed-by tag.

Therefore, this patch proposes to replace a count of "0" by a "-". So
patches with no tags will have "- - -" in their A/R/T column, and
patches with some tags may get "1 - 1" for example.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agomodels: Resolve issues with Patch.state
Stephen Finucane [Wed, 22 Jul 2015 08:34:58 +0000 (09:34 +0100)] 
models: Resolve issues with Patch.state

The initial migration introduced in '30bb271' was incomplete: running
'makemigrations' on the current codebase will produce a migration which
could not be applied cleanly. The reason for this was the non-loading
of initial data for the 'State' model.

Fix this issue by only referencing the contents of the 'State' model
when we have to (on save of a 'Patch' object), thus allowing the user
suitable time to apply this initial data.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agologin: Focus the username field on load
Damien Lespiau [Mon, 24 Aug 2015 14:25:42 +0000 (15:25 +0100)] 
login: Focus the username field on load

Wolfram wanted a small usability improvement that's easy to add: placing
the cursor automatically in the user name field when loading the login
page.

Suggested-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Stephen Finucane <stephen.finucane@intel.com>
10 years agotemplates: Pull jquery into base.html
Damien Lespiau [Sun, 31 Aug 2014 21:31:02 +0000 (22:31 +0100)] 
templates: Pull jquery into base.html

Bootstrap needs jquery for its own JS facilities, so include it on every
page.

Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotests: Move 'reverse' calls inside 'setUp'
Stephen Finucane [Fri, 21 Aug 2015 14:32:11 +0000 (15:32 +0100)] 
tests: Move 'reverse' calls inside 'setUp'

Django creates test databases after it loads tests. However, any
operations that exist at class level will be executed before this
database is created. Fix the instances of this issue (mostly 'reverse'
calls or similar) by moving the calls into the relevant 'setUp'
functions for each test.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agosettings: Move 'TEST_RUNNER' to correct location
Stephen Finucane [Fri, 21 Aug 2015 14:32:20 +0000 (15:32 +0100)] 
settings: Move 'TEST_RUNNER' to correct location

Try to keep the order/structure of this file intact for as
long as possible.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agosettings: Fix deprecated 'TEST_CHARSET' warning
Stephen Finucane [Fri, 21 Aug 2015 14:32:19 +0000 (15:32 +0100)] 
settings: Fix deprecated 'TEST_CHARSET' warning

Resolve a 'RemovedInDjango19Warning' with the 'TEST_CHARSET' option.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Add missing licenses to 'management'
Stephen Finucane [Fri, 21 Aug 2015 14:32:18 +0000 (15:32 +0100)] 
trivial: Add missing licenses to 'management'

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Resolve PEP8 issues with 'management'
Stephen Finucane [Fri, 21 Aug 2015 14:32:17 +0000 (15:32 +0100)] 
trivial: Resolve PEP8 issues with 'management'

(Added by Damien) This also moves from sys.stdout/sys.stderr to
self.stdout/self.stderr as adviced by the Django documentation.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agomanagement: Resolve a bug with 'retag' command
Stephen Finucane [Fri, 21 Aug 2015 14:32:16 +0000 (15:32 +0100)] 
management: Resolve a bug with 'retag' command

Calling 'retag' without a list of patch IDs will cause an Exception.
This is due to an invalid attempt to filter patches using this empty
argument. Resolve this by only filtering when we have arguments to
filter with.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agomanagement: Resolve bugs with 'cron' command
Stephen Finucane [Fri, 21 Aug 2015 14:32:15 +0000 (15:32 +0100)] 
management: Resolve bugs with 'cron' command

Resolve two bugs with the script:

- There's no 'main' function to call
- A variable is misnamed

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Remove dead imports from 'tests'
Stephen Finucane [Fri, 21 Aug 2015 14:32:14 +0000 (15:32 +0100)] 
trivial: Remove dead imports from 'tests'

Remove some unused imports. This keeps PEP8 happy.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotests/test_user: Add "profile POST" tests
Stephen Finucane [Fri, 21 Aug 2015 14:32:13 +0000 (15:32 +0100)] 
tests/test_user: Add "profile POST" tests

POSTing to the 'profile' view will allow configuration of some user
profiles, but this was not being tested. Resolve this.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotests/test_user: Add "profile unlink" tests
Stephen Finucane [Fri, 21 Aug 2015 14:32:12 +0000 (15:32 +0100)] 
tests/test_user: Add "profile unlink" tests

The 'link' view was not being tested. Resolve this with tests for all
paths.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Remove Python < 2.5 code
Stephen Finucane [Fri, 21 Aug 2015 14:32:10 +0000 (15:32 +0100)] 
trivial: Remove Python < 2.5 code

None of the supported versions of Django (currently 1.6 -> 1.8)
support Python < 2.6. There is no need to keep code for older
versions of Python around.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Resolve some PEP8 issues
Stephen Finucane [Fri, 21 Aug 2015 14:32:09 +0000 (15:32 +0100)] 
trivial: Resolve some PEP8 issues

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotrivial: Remove dead files/code
Stephen Finucane [Fri, 21 Aug 2015 14:32:08 +0000 (15:32 +0100)] 
trivial: Remove dead files/code

Remove some swathes of code that are no longer used, some of which
contains issues that renders them useless.

This unused code was initially discovered by using 'coverage.py'
followed by manual inspection.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agodocs: Rewrite documentation
Stephen Finucane [Fri, 21 Aug 2015 14:32:07 +0000 (15:32 +0100)] 
docs: Rewrite documentation

The INSTALL and HACKING documents are an important guide for new
patchwork users and developers and should be as informative as
possible. A number of changes were needed to these documents owing
to the out-of-date or incomplete information they contained. These
changes include:

* Removing references to the dead mod_python/flup projects
* Adding references to Gunicorn+nginx, which a credible modern
  alternative to Apache+mod_wsgi
* Providing explanatory links to concepts/tools like ident-based
  authentication and tox
* Referencing the newer tools available to developers, like tox
  and the 'requirements.txt' files
* Integration with mkdocs, with eye on eventual publishing of
  documentation to ReadTheDocs or equivalent.

These changes result in a significant rewrite which should hopefully
lower the barrier to entry for people wishing to use or develop
patchwork.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agotox: Update versions of Django to be tested
Stephen Finucane [Fri, 21 Aug 2015 14:32:06 +0000 (15:32 +0100)] 
tox: Update versions of Django to be tested

Since patchwork now supports Django 1.8 and no longer support 1.5, it
is necessary to update the tox targets to validate this new subset of
supported Django versions.

In addition, the paths to the requirements.txt files were not updated
as part of a rebase. Correct this oversight.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agoAdd missing explicit state fixture load
Stephen Finucane [Fri, 21 Aug 2015 14:32:05 +0000 (15:32 +0100)] 
Add missing explicit state fixture load

The 'patchwork: Explicitly load states fixtures' change introduced
explicit state loading into many of the tests, but missed one.
Correct this oversight.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
10 years agopatchwork/templates: Suppress cycle template tag warning
Jeremy Kerr [Fri, 5 Jun 2015 06:53:07 +0000 (14:53 +0800)] 
patchwork/templates: Suppress cycle template tag warning

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>
10 years agopatchwork/views: request.REQUEST is deprecated in django 1.8
Jeremy Kerr [Fri, 5 Jun 2015 06:48:31 +0000 (14:48 +0800)] 
patchwork/views: request.REQUEST is deprecated in django 1.8

.. so do explicit accesses to request.GET or request.POST.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agopatchwork/parser: Adapt for new unsaved-foreign-key behaviour in django 1.8
Jeremy Kerr [Fri, 5 Jun 2015 06:33:13 +0000 (14:33 +0800)] 
patchwork/parser: Adapt for new unsaved-foreign-key behaviour in django 1.8

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>
10 years agopatchwork: Add initial migrations
Jeremy Kerr [Thu, 4 Jun 2015 10:13:13 +0000 (18:13 +0800)] 
patchwork: Add initial migrations

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>
10 years agopatchwork: Explicitly load states fixtures
Jeremy Kerr [Fri, 5 Jun 2015 06:32:26 +0000 (14:32 +0800)] 
patchwork: Explicitly load states fixtures

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>
10 years agopatchwork/views: prefetch delegate in generic_list
Jeremy Kerr [Thu, 4 Jun 2015 09:58:51 +0000 (17:58 +0800)] 
patchwork/views: prefetch delegate in generic_list

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>
10 years agopatchwork/models: Use OneToOneField for PatchChangeNotifcation.patch
Jeremy Kerr [Thu, 4 Jun 2015 09:49:01 +0000 (17:49 +0800)] 
patchwork/models: Use OneToOneField for PatchChangeNotifcation.patch

Same functionality, but we suppress an error from django 1.8+

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoparsemail: Don't catch all exceptions when a Project isn't found
Jeremy Kerr [Fri, 29 May 2015 00:07:19 +0000 (08:07 +0800)] 
parsemail: Don't catch all exceptions when a Project isn't found

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>
10 years agoparsemail: run django.setup to initialise Models
Jeremy Kerr [Fri, 29 May 2015 00:06:24 +0000 (08:06 +0800)] 
parsemail: run django.setup to initialise Models

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>
10 years agotests: Remove old-style test runner module
Jeremy Kerr [Thu, 28 May 2015 05:44:14 +0000 (13:44 +0800)] 
tests: Remove old-style test runner module

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>
10 years agocron: Move patchwork-cron script to a management command
Jeremy Kerr [Thu, 28 May 2015 05:39:05 +0000 (13:39 +0800)] 
cron: Move patchwork-cron script to a management command

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agopatchwork/utils: Remove unnecessary MultiplePatchForm import
Jeremy Kerr [Thu, 28 May 2015 05:26:19 +0000 (13:26 +0800)] 
patchwork/utils: Remove unnecessary MultiplePatchForm import

It's not used in utils.py

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodoc: Add NEWS file for recent updates
Jeremy Kerr [Thu, 28 May 2015 02:24:54 +0000 (10:24 +0800)] 
doc: Add NEWS file for recent updates

... containing a guide to migrating to the recent changes.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoAdd patch tag infrastructure
Jeremy Kerr [Wed, 27 May 2015 01:56:36 +0000 (09:56 +0800)] 
Add patch tag infrastructure

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>
10 years agodocs: Add collectstatic step to installation instructions
Jeremy Kerr [Mon, 25 May 2015 09:50:45 +0000 (17:50 +0800)] 
docs: Add collectstatic step to installation instructions

Because we're now using the staticfiles app, we need to run
collectstatic on init.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoUpdate documentation and default settings to suit patchwork deployment model
Jeremy Kerr [Sun, 24 May 2015 09:50:33 +0000 (17:50 +0800)] 
Update documentation and default settings to suit patchwork deployment model

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>
10 years agobin: Fix references to old settings module location
Jeremy Kerr [Wed, 27 May 2015 02:25:54 +0000 (10:25 +0800)] 
bin: Fix references to old settings module location

Since the settings modules have changed locations, we need to update the
parsemail script too.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agodocs: Fix documentation for new settings infrastructure
Jeremy Kerr [Sun, 24 May 2015 09:33:13 +0000 (17:33 +0800)] 
docs: Fix documentation for new settings infrastructure

A few tweaks for the INSTALL doc to update to the settings changes from
c641660e.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agolib/apache2: Update sample configuration files for new staticfiles application
Jeremy Kerr [Sun, 24 May 2015 09:31:56 +0000 (17:31 +0800)] 
lib/apache2: Update sample configuration files for new staticfiles application

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>
10 years agolib/apache2: use django-1.7-compatible wsgi application
Jeremy Kerr [Sun, 24 May 2015 09:21:15 +0000 (17:21 +0800)] 
lib/apache2: use django-1.7-compatible wsgi application

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoMove to a more recent django project structure
Jeremy Kerr [Sun, 24 May 2015 08:57:33 +0000 (16:57 +0800)] 
Move to a more recent django project structure

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>
10 years agotox: Add tox.ini file
Stephen Finucane [Tue, 7 Apr 2015 21:20:55 +0000 (22:20 +0100)] 
tox: Add tox.ini file

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>
10 years agosettings: Split 'settings.py' into multiple files
Stephen Finucane [Tue, 7 Apr 2015 21:20:54 +0000 (22:20 +0100)] 
settings: Split 'settings.py' into multiple files

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>
10 years agoIntegrate 'django.contrib.staticfiles'
Stephen Finucane [Tue, 7 Apr 2015 21:20:53 +0000 (22:20 +0100)] 
Integrate 'django.contrib.staticfiles'

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>
10 years agosettings: Restructure settings file
Stephen Finucane [Tue, 7 Apr 2015 21:20:52 +0000 (22:20 +0100)] 
settings: Restructure settings file

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>
10 years agodocs: Use 'prod' and 'dev' requirements files
Stephen Finucane [Tue, 7 Apr 2015 21:20:51 +0000 (22:20 +0100)] 
docs: Use 'prod' and 'dev' requirements files

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>
10 years agosettings: Resolve all but one Django 1.7 warning
Stephen Finucane [Tue, 7 Apr 2015 21:20:50 +0000 (22:20 +0100)] 
settings: Resolve all but one Django 1.7 warning

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>
10 years agoviews: Replace 'mimetype' with 'content_type'
Stephen Finucane [Tue, 7 Apr 2015 21:20:49 +0000 (22:20 +0100)] 
views: Replace 'mimetype' with 'content_type'

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>
10 years agoResolve removed 'AUTH_PROFILE_MODULE' setting
Stephen Finucane [Tue, 7 Apr 2015 21:20:48 +0000 (22:20 +0100)] 
Resolve removed 'AUTH_PROFILE_MODULE' setting

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>
10 years agoMake the submitter name link to a query for that submitter
Michael Ellerman [Mon, 23 Mar 2015 06:56:22 +0000 (17:56 +1100)] 
Make the submitter name link to a query for that submitter

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>
10 years agopwclient: honor PAGER for view
aldot [Mon, 2 Mar 2015 15:18:34 +0000 (16:18 +0100)] 
pwclient: honor PAGER for view

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>
10 years agoparser: Fix parsing of patches with a trailing no-newline marker v0.9.0
Michael Ellerman [Wed, 18 Mar 2015 03:39:24 +0000 (14:39 +1100)] 
parser: Fix parsing of patches with a trailing no-newline marker

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>
10 years agoINSTALL: Fix indentation (whitespace only change) to 4 spaces
Bryce Harrington [Fri, 5 Dec 2014 21:23:09 +0000 (13:23 -0800)] 
INSTALL: Fix indentation (whitespace only change) to 4 spaces

Also, 2 newlines after each section.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoINSTALL: Fix some minor typos
Bryce Harrington [Fri, 5 Dec 2014 21:23:07 +0000 (13:23 -0800)] 
INSTALL: Fix some minor typos

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoAlways use #!/usr/bin/env python
Damien Lespiau [Sat, 15 Nov 2014 01:58:25 +0000 (01:58 +0000)] 
Always use #!/usr/bin/env python

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>
10 years agopwclient: support 'archived' filtering and updating
Brian Norris [Sun, 23 Nov 2014 05:49:53 +0000 (21:49 -0800)] 
pwclient: support 'archived' filtering and updating

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>
10 years agopwclient: drop unused variables
Brian Norris [Sun, 23 Nov 2014 05:49:52 +0000 (21:49 -0800)] 
pwclient: drop unused variables

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoxmlrpc: support filtering by 'archived'
Brian Norris [Sun, 23 Nov 2014 05:49:51 +0000 (21:49 -0800)] 
xmlrpc: support filtering by 'archived'

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agopwclient: exit on first patch which fails to apply
Brian Norris [Sun, 23 Nov 2014 04:38:46 +0000 (20:38 -0800)] 
pwclient: exit on first patch which fails to apply

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>
10 years agopwclient: add project option to single-patch commands
Brian Norris [Sun, 23 Nov 2014 04:38:45 +0000 (20:38 -0800)] 
pwclient: add project option to single-patch commands

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>
10 years agoINSTALL: fix mysql syntax
Brian Norris [Sun, 23 Nov 2014 04:38:44 +0000 (20:38 -0800)] 
INSTALL: fix mysql syntax

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>
10 years agoTODO: remove completed items
Brian Norris [Sun, 23 Nov 2014 04:38:43 +0000 (20:38 -0800)] 
TODO: remove completed items

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>
10 years agoxmlrpc: include UNIX mbox 'From ' header in patch_get_mbox()
Brian Norris [Sun, 23 Nov 2014 04:38:42 +0000 (20:38 -0800)] 
xmlrpc: include UNIX mbox 'From ' header in patch_get_mbox()

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>
10 years agoxmlrpc: add 'archived' status to patch summary
Brian Norris [Sun, 23 Nov 2014 04:38:41 +0000 (20:38 -0800)] 
xmlrpc: add 'archived' status to patch summary

This will now show up in 'pwclient info'.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
10 years agoviews/xmlrpc: fix xmlrpc delegate filtering
Johannes Berg [Tue, 6 Jan 2015 10:21:37 +0000 (11:21 +0100)] 
views/xmlrpc: fix xmlrpc delegate filtering

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>