summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/bin/pwclient
Commit message (Collapse)AuthorAgeFilesLines
* Move to a more recent django project structureJeremy Kerr2015-05-271-744/+0
| | | | | | | | | | This change updates patchwor to the newer project struture: we've moved the actual application out of the apps/ directory, and the patchwork-specific templates to under the patchwork application. This gives us the manage.py script in the top-level now. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: honor PAGER for viewaldot2015-05-031-4/+19
| | | | | | | Use the PAGER of the environment to view patches Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: support 'archived' filtering and updatingBrian Norris2015-03-221-2/+17
| | | | | | | | | | | | | | | | | | | | | | Examples: # Mark patch as uperseded and archived pwclient update -s Superseded -a yes <ID> # List all archived patches pwclient list -a yes Notably, we still leave the '-s' option as required for 'pwclient update'; so you can't *just* archive a patch without setting its state. I couldn't quite figure out the right argparse usage to represent that the user must include one or both of '-s' and '-a'. And of course, the server must have an updated xmlrpc that supports the 'archived' field for list filtering (recently patched), otherwise you'll just get an empty list. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: drop unused variablesBrian Norris2015-03-221-1/+0
| | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: exit on first patch which fails to applyBrian Norris2015-03-221-2/+9
| | | | | | | | | | | | | When run with more than one patch ID, the 'apply' and 'git-am' commands should not continue to process other patches if an earlier one failed. We should stop so the user can address the situation. Future work: it'd be nice to just pipe all the patches at once to git-am, so that git's nice handling of fixup-and-continue workflow can be used. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add project option to single-patch commandsBrian Norris2015-03-221-0/+4
| | | | | | | | | | | | | | | | | | Previously, we could not target a particular server instance with the apply, git-am, info, and view subcommands. Under a single-server design, we never needed to target a particular project for a patch. We just targeted the patch itself. But with the advent of multi-server .pwclientrc configurations, we should allow pwclient to specify the project for these commands. This adds the '-p PROJECT' option to: * apply * git-am * info * view Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add %{_msgid_} to print message-id without surrounding < and >Jani Nikula2014-11-101-1/+8
| | | | | | | | The angle brackets are not really part of the message-id. Making it possible to get the message-id without them is helpful. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add output format option to list/search commandJani Nikula2014-11-101-10/+27
| | | | | | | | | Make scripting easier by letting the user specify the output format. The format string may contain tag references to fields, such as %{id} and %{msgid}. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Remove unhandled action 'save'Bernhard Reutner-Fischer2014-11-101-1/+1
| | | | | | | The 'save' action really is called 'get' (as opposed to 'view'). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Rephrase patch_ids iteratorBernhard Reutner-Fischer2014-11-101-10/+14
| | | | | | | | Don't generate an empty array, use for-loop instead as noticed by Jacob E. Keller Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Simplify argument handlingBernhard Reutner-Fischer2014-11-101-27/+13
| | | | | | | | dict().get() returns a default of None, use that to initialize our internal variables. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add --help / -? to all sub commandsBernhard Reutner-Fischer2014-11-101-19/+25
| | | | | | | Remove over-cautious helptext printing while at it Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: preserve ordering of patch idsJeremy Kerr2014-09-071-1/+1
| | | | | | | | | | | Currently, we use a frozenset to remove duplicates in the patch id list. However, this means we lose the patch ordering, which is important for a git-am. This change drops the frozenset, so we preserve the ordering from the arguments. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: diagnose hash_parser errors gracefullyBernhard Reutner-Fischer2014-09-071-12/+33
| | | | | | | | | | | a386e636cc0adaa760a66b6ab042178027fc45c7 removed argparse mutual exclusive group, so manually diagnose: 1) missing required hash_str / IDs 2) if both hash_str as well as IDs are seen Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: allow multiple IDsBernhard Reutner-Fischer2014-09-071-26/+34
| | | | | | | | | | | | | | | | | | | | Allow commands that take an ID to operate on multiple IDs. E.g.: update -s Superseded 1 2 3 4 5 apply 2 4 6 Reject update -c COMMIT-REF on multiple IDs though as that does not make sense. Implementation note: nargs='*' instead of '?' results in (wrong/inconvenient): mutually exclusive arguments must be optional So remove mutual exclusive handling via argparse and instead do it by hand. This might be implemented more conveniently in later python but we (have to) stick with 2.7.x for the time being. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: support signoff in the pwclientrcBernhard Reutner-Fischer2014-09-071-1/+7
| | | | | | | | | | | | Try to obtain git-am '--signoff' settings from: - the commandline - the global option section - per-project section v2: handle NoOptionError Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Remove now obsolete usage()Bernhard Reutner-Fischer2014-09-071-32/+4
| | | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: simplify hash/id handlingBernhard Reutner-Fischer2014-09-071-39/+28
| | | | | | | and obtain "action" from args.subcmd while at it Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: add git-am -s supportBernhard Reutner-Fischer2014-09-071-45/+192
| | | | | | | Optionally pass --signoff to git-am Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: accept more than one project in ~/.pwclientrcYann E. MORIN2014-07-041-14/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, given the format of ~/.pwclientrc, pwclient can only really act on a single project, as ~/pwclientrc can only contain the configuration for a single project. Although the -p options comes in handy to specify a project different from the one configured in ~/.pwclientrc, this only works if it is hosted on the same server. As soon as one needs to switch server, it is necessary to edit ~/pwclientrc. This can be quite inefficient when dealing with many projects, hosted on different servers. Change the format of ~/.pwclientrc so it is possible to define more than one project, and for each project, specify an URL and credentials. The new format is like: [options] default = project-A [project-A] url = http://my.patchwork.server/path/to/xmlrpc username = that-is-me password = secret [other-project] url = http://you.get/the/idea username = someone password = 1234 This has the advantage of not changing the options to pwclient, so the user experience is unmodified. If a ~/.pwclentrc exists in the old format, it is automatically converted over to the new format, and the previous one is saved as ~/.pwclientrc.orig. Upon conversion, no action is made, pwclient just exits (with return-code 1) to inform the user to review the conversion. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: rename variable CONFIG_FILES to be singularYann E. MORIN2014-07-041-2/+2
| | | | | | | | | | | We only support a single config file, so there is no need to have a plural in this variable. Also, we'll need to know what the default config file is, when we want to save it to migrate to the new format. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: fix handling UTF-8 in patch infoAndreas Bießmann2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* pwclient: Add a little more space in 'pwclient list'Doug Anderson2012-12-301-3/+3
| | | | | | | | 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>
* pwclient: Add command for printing patch infoDoug Anderson2012-12-301-2/+14
| | | | | | | | 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>
* pwclient: lookup patch_id given Message-IdBen Myers2012-11-051-2/+9
| | | | | | | | 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>
* pwclient: Pass input to git-am as a UTF-8 stringJeremy Kerr2012-09-041-1/+1
| | | | | | .. to prevent ascii codec exceptions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* patchwork: new pwclient git-am actiondavid decotigny2011-11-251-3/+20
| | | | | | | | | 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>
* templates: Fix pwclient no-match messagesDirk Wallenstein2011-02-111-2/+2
| | | | | Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: fix handling of UTF-8 char in submitter nameAndreas Bießmann2010-12-101-1/+2
| | | | | | | | | | | | | | | | | | | | This patch fixes following bug in 'list': ---8<--- # pwclient list -p uboot -w andreas.devel | grep New Traceback (most recent call last): File "/Users/andreas/bin/pwclient", line 463, in <module> main() File "/Users/andreas/bin/pwclient", line 411, in main action_list(rpc, filt, submitter_str, delegate_str) File "/Users/andreas/bin/pwclient", line 182, in action_list (person['name'], person['email']) UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 32: ordinal not in range(128) --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: allow authenticated https connectionsJeremy Kerr2010-03-191-4/+15
| | | | | | | | If the xmlrpc server is using HTTPS, we need to adapt our custom transport to use SafeTransport.make_connection Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Tested-by: Paul Mundt <lethal@linux-sh.org>
* pwclient get: fix for handling messages encoded in UTF-8Paul Menzel2010-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Trying `pwclient get` with a message containing UTF-8 characters you would get the following error. $ python -v pwclient get ID [...] # trying /usr/lib/python2.5/encodings/ascii.so # trying /usr/lib/python2.5/encodings/asciimodule.so # trying /usr/lib/python2.5/encodings/ascii.py # /usr/lib/python2.5/encodings/ascii.pyc matches /usr/lib/python2.5/encodings/ascii.py import encodings.ascii # precompiled from /usr/lib/python2.5/encodings/ascii.pyc Failed to write to subject.patch [...] You can reproduce it with $ pwclient get http://patchwork.openembedded.org/patch/1440/ and the fix is the same as in 4fc6a16910e595401e919abde28cca436193e0dd by Mauro Carvalho Chehab. Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
* pwclient: fallback to patch_get_by_hashJeremy Kerr2009-11-251-1/+7
| | | | | | | | | patch_get_by_project_hash isn't in older xmlrpc interfaces, so fall back to patch_get_by_hash if we see an xmlrpc fault when calling this function. Reported-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient,xmlrpc: Specify project for patch hash lookupsJeremy Kerr2009-10-221-3/+3
| | | | | | | | | | | | We may see the same hash for two patches if one is sent to two lists tracked by patchwork. This change adds a new xmlrpc method, patch_get_by_project_hash, which adds the linkname parameter to the lookup. We need to add a new method instead of replacing patch_get_by_hash, to avoid breaking existing pwclient apps. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Add newline to 'no hash' messageJeremy Kerr2009-10-221-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient fix for handling messages with UTF-8Mauro Carvalho Chehab2009-09-181-1/+1
| | | | | | | | | | | | | | | | | pwclient works fine viewing utf-8 messages, if you don't try to redirect stdout. However, if you do things like pwclient view 5063 >/tmp/patch, it fails due to the weird character handling logic in python: Traceback (most recent call last): File "/usr/local/bin/pwclient", line 446, in ? main() File "/usr/local/bin/pwclient", line 411, in main print s UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 249: ordinal not in range(128) Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Get rid of underscore to dash replacementNate Case2008-09-111-5/+3
| | | | | | | | | | | | | | | | I was erroneously doing some string substitutions so that it would find project names with an underscore in the name. It was only necessary due to a side effect of a bug fixed in commit 35241d528c3699b982730a333e236d57dc6451b6 (find project by linkname, not full name). In my test case, I had an underscore in the linkname, but a dash in the full name. No such string replacement is necessary, and actually breaks filtering by projects with an underscore in the name now that we're searching by linkname properly. Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Allow pwclient to accept patch hashesJeremy Kerr2008-09-101-5/+26
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Rename pwclient.py to pwclientJeremy Kerr2008-09-091-0/+427
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>