]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/bin/pwclient
pwclient,xmlrpc: Specify project for patch hash lookups
[patchwork] / apps / patchwork / bin / pwclient
index e25212a8a4088c4def4f608071e971c63db997e9..75fc6ff9d54cf9af62841a2dcb6dbf9b23f4a151 100755 (executable)
@@ -285,8 +285,8 @@ def action_update_patch(rpc, patch_id, state = None, commit = None):
     if not success:
         sys.stderr.write("Patch not updated\n")
 
-def patch_id_from_hash(rpc, hash):
-    patch = rpc.patch_get_by_hash(hash)
+def patch_id_from_hash(rpc, project, hash):
+    patch = rpc.patch_get_by_project_hash(project, hash)
     if patch == {}:
         return None
 
@@ -382,9 +382,9 @@ def main():
 
     patch_id = None
     if hash_str:
-        patch_id = patch_id_from_hash(rpc, hash_str)
+        patch_id = patch_id_from_hash(rpc, project_str, hash_str)
         if patch_id is None:
-            sys.stderr.write("No patch has the hash provided")
+            sys.stderr.write("No patch has the hash provided\n")
             sys.exit(1)
 
 
@@ -408,7 +408,7 @@ def main():
 
         s = rpc.patch_get_mbox(patch_id)
         if len(s) > 0:
-            print s
+            print unicode(s).encode("utf-8")
 
     elif action == 'get' or action == 'save':
         try: