From 166ba8eabe9e5963b59c77ea7d32bc17af2e91b5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 18 Oct 2016 17:58:31 +0100 Subject: If there are multiple remotes, use the one we are tracking Signed-off-by: Simon McVittie Differential Revision: https://phabricator.freedesktop.org/D1470 --- git-phab | 14 +++++++++++--- 1 file 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 : """ % self.phabricator_uri) remoteURIs=uris) if len(reply) > 1: - self.die("Multiple repositories returned for remote URIs " - "({}).\nYou should check your Phabricator " - "configuration.".format(', '.join(uris))) + tracking = self.repo.head.reference.tracking_branch() + # Use the remote that this branch is tracking. + uris = [remote.url for remote in self.repo.remotes + if remote.name == tracking.remote_name] + reply = self.phabricator.repository.query( + remoteURIs=uris) + + if len(reply) > 1: + self.die("Multiple repositories returned for remote URIs " + "({}).\nYou should check your Phabricator " + "configuration.".format(', '.join(uris))) try: self.phab_repo = reply[0] -- cgit v1.2.3