[PATCH] pwclient get: fix for handling messages encoded in UTF-8

2010-01-24 Thread Paul Menzel
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 paulepan...@users.sourceforge.net
---
 apps/patchwork/bin/pwclient |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient
index b0bd1d1..b480408 100755
--- a/apps/patchwork/bin/pwclient
+++ b/apps/patchwork/bin/pwclient
@@ -234,7 +234,7 @@ def action_get(rpc, patch_id):
 sys.exit(1)
 
 try:
-f.write(s)
+f.write(unicode(s).encode(utf-8))
 f.close()
 print Saved patch to %s % fname
 except:
-- 
1.6.6


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: scripts interaction of Patchwork and Git

2010-01-24 Thread Jeremy Kerr
Paul,

 Before I send other question in a separate threads I was wondering if
 you could share your scripts you all wrote to make your life easier as
 for example Git hooks.

OK, in the interests of writing stuff down, this is what I have:

* A hook in .git/hooks/post-applypatch:

 #!/bin/bash

 sha=$(git rev-parse HEAD)
 hash=$(git show $sha | pwparser --hash)
 pwclient update -s Accepted -c $sha -h $hash

* A 'catchup' script, to mark a range of revs as accepted:

 #!/bin/bash

 git rev-list $@ |
 while read commit
 do
 hash=$(git show $commit | pwparser --hash)
 pwclient update -h $hash -s Accepted -c $commit
 done

Note that pwparser is a symbolic link from ~/bin/pwparser to 
$patchwork/apps/bin/patchwork/parser.py. I need to work out a nicer way to 
distribute the parser code. Once that is done, I'll these to the online help.

Cheers,


Jeremy
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork