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)
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]