From 7fca89d1b31b8a17151b3771b7eb4380c9f34581 Mon Sep 17 00:00:00 2001 From: Ignas Mikalajunas Date: Wed, 26 Jun 2019 12:33:36 +0300 Subject: [PATCH 1/3] Added support for custom remote pushurl --- src/land/UberArcanistStackSubmitQueueEngine.php | 5 +---- src/land/UberArcanistSubmitQueueEngine.php | 5 +---- src/repository/api/ArcanistGitAPI.php | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/land/UberArcanistStackSubmitQueueEngine.php b/src/land/UberArcanistStackSubmitQueueEngine.php index 41c098c94..c02435f2b 100644 --- a/src/land/UberArcanistStackSubmitQueueEngine.php +++ b/src/land/UberArcanistStackSubmitQueueEngine.php @@ -350,11 +350,8 @@ protected function pushChangeToSubmitQueue() { pht('PUSHING'), pht('Pushing changes to Submit Queue.')); $api = $this->getRepositoryAPI(); - list($out) = $api->execxLocal( - 'config --get remote.%s.url', - $this->getTargetRemote()); + $remoteUrl = $api->uberGetGitRemotePushUrl($this->getTargetRemote()); - $remoteUrl = trim($out); $stack = $this->generateRevisionDiffMappingForLanding(); $statusUrl = $this->submitQueueClient->submitMergeStackRequest( $remoteUrl, diff --git a/src/land/UberArcanistSubmitQueueEngine.php b/src/land/UberArcanistSubmitQueueEngine.php index 5ca5bfa0d..cc7f06df8 100644 --- a/src/land/UberArcanistSubmitQueueEngine.php +++ b/src/land/UberArcanistSubmitQueueEngine.php @@ -94,11 +94,8 @@ protected function pushChangeToSubmitQueue() { pht('PUSHING'), pht('Pushing changes to Submit Queue.')); $api = $this->getRepositoryAPI(); - list($out) = $api->execxLocal( - 'config --get remote.%s.url', - $this->getTargetRemote()); + $remoteUrl = $api->uberGetGitRemotePushUrl($this->getTargetRemote()); - $remoteUrl = trim($out); // Get the latest revision as we could have updated the diff // as a result of arc diff $revision = $this->getRevision(); diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 56b38cb83..5558a8e5f 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1606,4 +1606,21 @@ public function uberHasGitSubmodules() { } return (bool)strlen(trim($out)); } + + /** + * Get the remote push url for a repository + */ + public function uberGetGitRemotePushUrl($remote) { + list($out) = $api->execxLocal( + 'config --get remote.%s.url', + $remote); + $pushUrl = trim($out); + try { + list($out) = $api->execxLocal( + 'config --get remote.%s.pushurl', + $remote); + $pushUrl = trim($out); + } catch (CommandException $ex) {} + return $pushUrl; + } } From c963acdff75f29a63fc9aee473c5da50e9f45d34 Mon Sep 17 00:00:00 2001 From: Ignas Mikalajunas Date: Wed, 26 Jun 2019 12:43:34 +0300 Subject: [PATCH 2/3] Make code order match url priorities --- src/repository/api/ArcanistGitAPI.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 5558a8e5f..aef98e692 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1611,16 +1611,15 @@ public function uberHasGitSubmodules() { * Get the remote push url for a repository */ public function uberGetGitRemotePushUrl($remote) { - list($out) = $api->execxLocal( - 'config --get remote.%s.url', - $remote); - $pushUrl = trim($out); try { list($out) = $api->execxLocal( 'config --get remote.%s.pushurl', $remote); - $pushUrl = trim($out); + return trim($out); } catch (CommandException $ex) {} - return $pushUrl; + list($out) = $api->execxLocal( + 'config --get remote.%s.url', + $remote); + return trim($out); } } From a8146f4515f4ff84c1e260441b394db68cf356f1 Mon Sep 17 00:00:00 2001 From: Ignas Mikalajunas Date: Wed, 26 Jun 2019 12:46:40 +0300 Subject: [PATCH 3/3] Use this instead of api --- src/repository/api/ArcanistGitAPI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index aef98e692..d70f25cc9 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1612,12 +1612,12 @@ public function uberHasGitSubmodules() { */ public function uberGetGitRemotePushUrl($remote) { try { - list($out) = $api->execxLocal( + list($out) = $this->execxLocal( 'config --get remote.%s.pushurl', $remote); return trim($out); } catch (CommandException $ex) {} - list($out) = $api->execxLocal( + list($out) = $this->execxLocal( 'config --get remote.%s.url', $remote); return trim($out);