diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-10-18 17:58:31 +0100 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2017-02-17 09:39:43 -0300 |
commit | 166ba8eabe9e5963b59c77ea7d32bc17af2e91b5 (patch) | |
tree | 232a1824ab5096e44561aae3aab0d12f4af0340b | |
parent | fd44d2f906b5dcbc656c45ab71f460308e599488 (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-x | git-phab | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -607,9 +607,17 @@ Paste API Token from that page and press <enter>: """ % 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] |