diff --git a/src/browse/ref/ArcanistBrowseURIRef.php b/src/browse/ref/ArcanistBrowseURIRef.php index e5ac2314..b83137f5 100644 --- a/src/browse/ref/ArcanistBrowseURIRef.php +++ b/src/browse/ref/ArcanistBrowseURIRef.php @@ -1,35 +1,31 @@ getURI()); } - public function defineHardpoints() { - return array(); - } - public function setURI($uri) { $this->uri = $uri; return $this; } public function getURI() { return $this->uri; } public function setType($type) { $this->type = $type; return $this; } public function getType() { return $this->type; } } diff --git a/src/ref/ArcanistRepositoryRef.php b/src/ref/ArcanistRepositoryRef.php index 5de6a310..e7e7a2ee 100644 --- a/src/ref/ArcanistRepositoryRef.php +++ b/src/ref/ArcanistRepositoryRef.php @@ -1,79 +1,75 @@ phid = $phid; return $this; } public function getPHID() { return $this->phid; } public function setBrowseURI($browse_uri) { $this->browseURI = $browse_uri; return $this; } public function newBrowseURI(array $params) { PhutilTypeSpec::checkMap( $params, array( 'path' => 'optional string|null', 'branch' => 'optional string|null', 'lines' => 'optional string|null', )); foreach ($params as $key => $value) { if (!strlen($value)) { unset($params[$key]); } } $defaults = array( 'path' => '/', 'branch' => $this->getDefaultBranch(), 'lines' => null, ); $params = $params + $defaults; $uri_base = $this->browseURI; $uri_base = rtrim($uri_base, '/'); $uri_branch = phutil_escape_uri_path_component($params['branch']); $uri_path = ltrim($params['path'], '/'); $uri_path = phutil_escape_uri($uri_path); $uri_lines = null; if ($params['lines']) { $uri_lines = '$'.phutil_escape_uri($params['lines']); } // TODO: This construction, which includes a branch, is probably wrong for // Subversion. return "{$uri_base}/browse/{$uri_branch}/{$uri_path}{$uri_lines}"; } public function getDefaultBranch() { // TODO: This should read from the remote, and is not correct for // Mercurial anyway, as "default" would be a better default branch. return 'master'; } } diff --git a/src/ref/ArcanistRevisionRef.php b/src/ref/ArcanistRevisionRef.php index ce964d8d..954ed565 100644 --- a/src/ref/ArcanistRevisionRef.php +++ b/src/ref/ArcanistRevisionRef.php @@ -1,76 +1,72 @@ getMonogram()); } - public function defineHardpoints() { - return array(); - } - public static function newFromConduit(array $dict) { $ref = new self(); $ref->parameters = $dict; return $ref; } public function getMonogram() { return 'D'.$this->getID(); } public function getStatusDisplayName() { return idx($this->parameters, 'statusName'); } public function isClosed() { // TODO: This should use sensible constants, not English language // display text. switch ($this->getStatusDisplayName()) { case 'Abandoned': case 'Closed': return true; } return false; } public function getURI() { return idx($this->parameters, 'uri'); } public function getFullName() { return pht('%s: %s', $this->getMonogram(), $this->getName()); } public function getID() { return idx($this->parameters, 'id'); } public function getPHID() { return idx($this->parameters, 'phid'); } public function getName() { return idx($this->parameters, 'title'); } public function getAuthorPHID() { return idx($this->parameters, 'authorPHID'); } public function addSource(ArcanistRevisionRefSource $source) { $this->sources[] = $source; return $this; } public function getSources() { return $this->sources; } }