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)
1487 1487
1488 reply = self.phabricator.maniphest.query(ids=[int(self.task[1:])]) 1488 reply = self.phabricator.maniphest.query(ids=[int(self.task[1:])])
1489 1489
1490 props = list(reply.values())[0] 1490 try:
1491 uri = props['auxiliary']['std:maniphest:git:uri-branch'] 1491 props = list(reply.values())[0]
1492 remote, branch = uri.split('#') 1492 uri = props['auxiliary']['std:maniphest:git:uri-branch']
1493 remote, branch = uri.split('#')
1494 except:
1495 self.die("Git URI is not set on task; cannot fetch it.")
1493 1496
1494 print("Git URI: %s, branch: %s" % (remote, branch)) 1497 print("Git URI: %s, branch: %s" % (remote, branch))
1495 self.repo.git.fetch(remote, "%s" % branch) 1498 self.repo.git.fetch(remote, "%s" % branch)