summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-08-02 14:25:20 +0100
committerThibault Saunier <tsaunier@gnome.org>2016-08-09 14:37:25 -0400
commit38c6376cc8b4ea0f329799a70ba62375a137f774 (patch)
treea256f6925d66e0aa55eec3f74676498f17bff6b1
parent0da87a382f2bc6abecf3136e242ed48295842c74 (diff)
fetch: Gracefully error if task has no git URI set
Rather than aborting with a string processing exception. Reviewed-by: Thibault Saunier <tsaunier@gnome.org> Differential Revision: https://phabricator.freedesktop.org/D1237
-rwxr-xr-xgit-phab9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-phab b/git-phab
index b89f204..aa668ce 100755
--- a/git-phab
+++ b/git-phab
@@ -1487,9 +1487,12 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
reply = self.phabricator.maniphest.query(ids=[int(self.task[1:])])
- props = list(reply.values())[0]
- uri = props['auxiliary']['std:maniphest:git:uri-branch']
- remote, branch = uri.split('#')
+ try:
+ props = list(reply.values())[0]
+ uri = props['auxiliary']['std:maniphest:git:uri-branch']
+ remote, branch = uri.split('#')
+ except:
+ self.die("Git URI is not set on task; cannot fetch it.")
print("Git URI: %s, branch: %s" % (remote, branch))
self.repo.git.fetch(remote, "%s" % branch)