summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-11-09 10:08:13 +0000
committerThibault Saunier <thibault.saunier@osg.samsung.com>2016-11-09 09:54:49 -0300
commit8a2cac12e2c1805e05c45a52d72beb8b25b7e0df (patch)
treec39327e774910385b0cf5e6d204f80d2b1a7faee
parent5293c3dc41cc32f095397bfe4102fef3cad94b79 (diff)
git-phab: Fix additions and deletions of binary files
The code was only handling changes to, or renames of, binary files. Additionally, it was never uploading the old binary file, so these changes were appearing as file additions. Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: Thibault Saunier <tsaunier@gnome.org> Differential Revision: https://phabricator.freedesktop.org/D1455
-rwxr-xr-xgit-phab23
1 files changed, 18 insertions, 5 deletions
diff --git a/git-phab b/git-phab
index 96ace89..4683564 100755
--- a/git-phab
+++ b/git-phab
@@ -875,16 +875,29 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
875 filetype = "1" 875 filetype = "1"
876 else: 876 else:
877 hunks = [] 877 hunks = []
878 phab_file = self.phabricator.file.upload( 878
879 data_base64=base64.standard_b64encode( 879 if not diff.deleted_file:
880 diff.b_blob.data_stream[-1].read()).decode("utf-8")) 880 b_phab_file = self.phabricator.file.upload(
881 data_base64=base64.standard_b64encode(
882 diff.b_blob.data_stream[-1].read()).decode("utf-8"))
883 else:
884 b_phab_file = None
885
886 if not diff.new_file:
887 a_phab_file = self.phabricator.file.upload(
888 data_base64=base64.standard_b64encode(
889 diff.a_blob.data_stream[-1].read()).decode("utf-8"))
890 else:
891 a_phab_file = None
881 892
882 filetype = "3" 893 filetype = "3"
883 metadata = { 894 metadata = {
884 "old:file:size": diff.a_blob.size if diff.a_blob else 0, 895 "old:file:size": diff.a_blob.size if diff.a_blob else 0,
896 "old:file:mime-type": diff.a_blob.mime_type if diff.a_blob else '',
897 "old:binary-phid": a_phab_file.response if a_phab_file else '',
885 "new:file:size": diff.b_blob.size if diff.b_blob else 0, 898 "new:file:size": diff.b_blob.size if diff.b_blob else 0,
886 "new:file:mime-type": diff.b_blob.mime_type, 899 "new:file:mime-type": diff.b_blob.mime_type if diff.b_blob else '',
887 "new:binary-phid": phab_file.response 900 "new:binary-phid": b_phab_file.response if b_phab_file else '',
888 } 901 }
889 902
890 return change_filename, {"metadata": metadata, 903 return change_filename, {"metadata": metadata,