Page MenuHomePhabricator

D16100.id.diff
No OneTemporary

D16100.id.diff

diff --git a/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
--- a/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php
@@ -69,11 +69,6 @@
$uri_object = new PhutilURI($uri);
$domain = $uri_object->getDomain();
- if (!strlen($domain)) {
- $uri_object = new PhutilGitURI($uri);
- $domain = $uri_object->getDomain();
- }
-
$domain = phutil_utf8_strtolower($domain);
switch ($domain) {
case 'github.com':
diff --git a/src/applications/repository/data/PhabricatorRepositoryURINormalizer.php b/src/applications/repository/data/PhabricatorRepositoryURINormalizer.php
--- a/src/applications/repository/data/PhabricatorRepositoryURINormalizer.php
+++ b/src/applications/repository/data/PhabricatorRepositoryURINormalizer.php
@@ -78,16 +78,7 @@
switch ($this->type) {
case self::TYPE_GIT:
$uri = new PhutilURI($this->uri);
- if ($uri->getProtocol()) {
- return $uri->getPath();
- }
-
- $uri = new PhutilGitURI($this->uri);
- if ($uri->getDomain()) {
- return $uri->getPath();
- }
-
- return $this->uri;
+ return $uri->getPath();
case self::TYPE_SVN:
case self::TYPE_MERCURIAL:
$uri = new PhutilURI($this->uri);
@@ -136,14 +127,7 @@
$domain = null;
$uri = new PhutilURI($this->uri);
- if ($uri->getProtocol()) {
- $domain = $uri->getDomain();
- }
-
- if (!strlen($domain)) {
- $uri = new PhutilGitURI($this->uri);
- $domain = $uri->getDomain();
- }
+ $domain = $uri->getDomain();
if (!strlen($domain)) {
$domain = '<void>';
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -1201,27 +1201,19 @@
*/
public function getRemoteProtocol() {
$uri = $this->getRemoteURIObject();
-
- if ($uri instanceof PhutilGitURI) {
- return 'ssh';
- } else {
- return $uri->getProtocol();
- }
+ return $uri->getProtocol();
}
/**
- * Get a parsed object representation of the repository's remote URI. This
- * may be a normal URI (returned as a @{class@libphutil:PhutilURI}) or a git
- * URI (returned as a @{class@libphutil:PhutilGitURI}).
+ * Get a parsed object representation of the repository's remote URI..
*
- * @return wild A @{class@libphutil:PhutilURI} or
- * @{class@libphutil:PhutilGitURI}.
+ * @return wild A @{class@libphutil:PhutilURI}.
* @task uri
*/
public function getRemoteURIObject() {
$raw_uri = $this->getDetail('remote-uri');
- if (!$raw_uri) {
+ if (!strlen($raw_uri)) {
return new PhutilURI('');
}
@@ -1229,17 +1221,7 @@
return new PhutilURI('file://'.$raw_uri);
}
- $uri = new PhutilURI($raw_uri);
- if ($uri->getProtocol()) {
- return $uri;
- }
-
- $uri = new PhutilGitURI($raw_uri);
- if ($uri->getDomain()) {
- return $uri;
- }
-
- throw new Exception(pht("Remote URI '%s' could not be parsed!", $raw_uri));
+ return new PhutilURI($raw_uri);
}
@@ -1666,27 +1648,14 @@
return $this;
}
- public static function getRemoteURIProtocol($raw_uri) {
- $uri = new PhutilURI($raw_uri);
- if ($uri->getProtocol()) {
- return strtolower($uri->getProtocol());
- }
-
- $git_uri = new PhutilGitURI($raw_uri);
- if (strlen($git_uri->getDomain()) && strlen($git_uri->getPath())) {
- return 'ssh';
- }
-
- return null;
- }
-
public static function assertValidRemoteURI($uri) {
if (trim($uri) != $uri) {
throw new Exception(
pht('The remote URI has leading or trailing whitespace.'));
}
- $protocol = self::getRemoteURIProtocol($uri);
+ $uri_object = new PhutilURI($uri);
+ $protocol = $uri_object->getProtocol();
// Catch confusion between Git/SCP-style URIs and normal URIs. See T3619
// for discussion. This is usually a user adding "ssh://" to an implicit
diff --git a/src/applications/repository/storage/PhabricatorRepositoryURI.php b/src/applications/repository/storage/PhabricatorRepositoryURI.php
--- a/src/applications/repository/storage/PhabricatorRepositoryURI.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryURI.php
@@ -191,11 +191,6 @@
return self::IO_NONE;
}
-
- public function getDisplayURI() {
- return $this->getURIObject(false);
- }
-
public function getNormalizedURI() {
$vcs = $this->getRepository()->getVersionControlSystem();
@@ -216,8 +211,12 @@
return $normal_uri->getNormalizedURI();
}
+ public function getDisplayURI() {
+ return $this->getURIObject();
+ }
+
public function getEffectiveURI() {
- return $this->getURIObject(true);
+ return $this->getURIObject();
}
public function getURIEnvelope() {
@@ -243,11 +242,10 @@
return new PhutilOpaqueEnvelope((string)$uri);
}
- private function getURIObject($normalize) {
+ private function getURIObject() {
// Users can provide Git/SCP-style URIs in the form "user@host:path".
- // These are equivalent to "ssh://user@host/path". We use the more standard
- // form internally, and convert to it if we need to specify a port number,
- // but try to preserve what the user typed when displaying the URI.
+ // In the general case, these are not equivalent to any "ssh://..." form
+ // because the path is relative.
if ($this->isBuiltin()) {
$builtin_protocol = $this->getForcedProtocol();
@@ -271,43 +269,22 @@
// with it; this should always be provided by the associated credential.
$uri->setPass(null);
- if (!$uri->getProtocol()) {
- $git_uri = new PhutilGitURI($raw_uri);
-
- // We must normalize this Git-style URI into a normal URI
- $must_normalize = ($port && ($port != $default_ports['ssh']));
- if ($must_normalize || $normalize) {
- $domain = $git_uri->getDomain();
-
-
- $uri = id(new PhutilURI("ssh://{$domain}"))
- ->setUser($git_uri->getUser())
- ->setPath($git_uri->getPath());
- } else {
- $uri = $git_uri;
- }
+ $protocol = $this->getForcedProtocol();
+ if ($protocol) {
+ $uri->setProtocol($protocol);
}
- $is_normal = ($uri instanceof PhutilURI);
-
- if ($is_normal) {
- $protocol = $this->getForcedProtocol();
- if ($protocol) {
- $uri->setProtocol($protocol);
- }
-
- if ($port) {
- $uri->setPort($port);
- }
+ if ($port) {
+ $uri->setPort($port);
+ }
- // Remove any explicitly set default ports.
- $uri_port = $uri->getPort();
- $uri_protocol = $uri->getProtocol();
+ // Remove any explicitly set default ports.
+ $uri_port = $uri->getPort();
+ $uri_protocol = $uri->getProtocol();
- $uri_default = idx($default_ports, $uri_protocol);
- if ($uri_default && ($uri_default == $uri_port)) {
- $uri->setPort(null);
- }
+ $uri_default = idx($default_ports, $uri_protocol);
+ if ($uri_default && ($uri_default == $uri_port)) {
+ $uri->setPort(null);
}
$user = $this->getForcedUser();

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 5:09 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7386974
Default Alt Text
D16100.id.diff (7 KB)

Event Timeline