summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2016-10-18 17:58:31 +0100
committerThibault Saunier <thibault.saunier@osg.samsung.com>2017-02-17 09:39:43 -0300
commit166ba8eabe9e5963b59c77ea7d32bc17af2e91b5 (patch)
tree232a1824ab5096e44561aae3aab0d12f4af0340b
parentfd44d2f906b5dcbc656c45ab71f460308e599488 (diff)
If there are multiple remotes, use the one we are tracking
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D1470
-rwxr-xr-xgit-phab14
1 files changed, 11 insertions, 3 deletions
diff --git a/git-phab b/git-phab
index 2d95223..b53721a 100755
--- a/git-phab
+++ b/git-phab
@@ -607,9 +607,17 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
607 remoteURIs=uris) 607 remoteURIs=uris)
608 608
609 if len(reply) > 1: 609 if len(reply) > 1:
610 self.die("Multiple repositories returned for remote URIs " 610 tracking = self.repo.head.reference.tracking_branch()
611 "({}).\nYou should check your Phabricator " 611 # Use the remote that this branch is tracking.
612 "configuration.".format(', '.join(uris))) 612 uris = [remote.url for remote in self.repo.remotes
613 if remote.name == tracking.remote_name]
614 reply = self.phabricator.repository.query(
615 remoteURIs=uris)
616
617 if len(reply) > 1:
618 self.die("Multiple repositories returned for remote URIs "
619 "({}).\nYou should check your Phabricator "
620 "configuration.".format(', '.join(uris)))
613 621
614 try: 622 try:
615 self.phab_repo = reply[0] 623 self.phab_repo = reply[0]