Page MenuHomePhabricator

D21082.id50222.diff
No OneTemporary

D21082.id50222.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -54,7 +54,6 @@
'ArcanistBraceFormattingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php',
'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBraceFormattingXHPASTLinterRuleTestCase.php',
'ArcanistBranchRef' => 'ref/ArcanistBranchRef.php',
- 'ArcanistBranchRefPro' => 'ref/ArcanistBranchRefPro.php',
'ArcanistBranchWorkflow' => 'workflow/ArcanistBranchWorkflow.php',
'ArcanistBrowseCommitHardpointLoader' => 'browse/loader/ArcanistBrowseCommitHardpointLoader.php',
'ArcanistBrowseCommitHardpointQuery' => 'browse/query/ArcanistBrowseCommitHardpointQuery.php',
@@ -66,13 +65,11 @@
'ArcanistBrowsePathURIHardpointQuery' => 'browse/query/ArcanistBrowsePathURIHardpointQuery.php',
'ArcanistBrowseRef' => 'browse/ref/ArcanistBrowseRef.php',
'ArcanistBrowseRefInspector' => 'inspector/ArcanistBrowseRefInspector.php',
- 'ArcanistBrowseRefPro' => 'browse/ref/ArcanistBrowseRefPro.php',
'ArcanistBrowseRevisionURIHardpointLoader' => 'browse/loader/ArcanistBrowseRevisionURIHardpointLoader.php',
'ArcanistBrowseRevisionURIHardpointQuery' => 'browse/query/ArcanistBrowseRevisionURIHardpointQuery.php',
'ArcanistBrowseURIHardpointLoader' => 'browse/loader/ArcanistBrowseURIHardpointLoader.php',
'ArcanistBrowseURIHardpointQuery' => 'browse/query/ArcanistBrowseURIHardpointQuery.php',
'ArcanistBrowseURIRef' => 'browse/ref/ArcanistBrowseURIRef.php',
- 'ArcanistBrowseURIRefPro' => 'browse/ref/ArcanistBrowseURIRefPro.php',
'ArcanistBrowseWorkflow' => 'browse/workflow/ArcanistBrowseWorkflow.php',
'ArcanistBuildPlanRef' => 'ref/ArcanistBuildPlanRef.php',
'ArcanistBuildRef' => 'ref/ArcanistBuildRef.php',
@@ -113,7 +110,6 @@
'ArcanistCommentStyleXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistCommentStyleXHPASTLinterRuleTestCase.php',
'ArcanistCommitRef' => 'ref/ArcanistCommitRef.php',
'ArcanistCommitRefInspector' => 'inspector/ArcanistCommitRefInspector.php',
- 'ArcanistCommitRefPro' => 'ref/ArcanistCommitRefPro.php',
'ArcanistCommitUpstreamHardpointLoader' => 'loader/ArcanistCommitUpstreamHardpointLoader.php',
'ArcanistCommitUpstreamHardpointQuery' => 'query/ArcanistCommitUpstreamHardpointQuery.php',
'ArcanistCommitWorkflow' => 'workflow/ArcanistCommitWorkflow.php',
@@ -401,7 +397,6 @@
'ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase.php',
'ArcanistRef' => 'ref/ArcanistRef.php',
'ArcanistRefInspector' => 'inspector/ArcanistRefInspector.php',
- 'ArcanistRefPro' => 'ref/ArcanistRefPro.php',
'ArcanistRefQuery' => 'ref/ArcanistRefQuery.php',
'ArcanistRepositoryAPI' => 'repository/api/ArcanistRepositoryAPI.php',
'ArcanistRepositoryAPIMiscTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIMiscTestCase.php',
@@ -415,7 +410,6 @@
'ArcanistReusedIteratorXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistReusedIteratorXHPASTLinterRuleTestCase.php',
'ArcanistRevertWorkflow' => 'workflow/ArcanistRevertWorkflow.php',
'ArcanistRevisionRef' => 'ref/ArcanistRevisionRef.php',
- 'ArcanistRevisionRefPro' => 'ref/ArcanistRevisionRefPro.php',
'ArcanistRevisionRefSource' => 'ref/ArcanistRevisionRefSource.php',
'ArcanistRuboCopLinter' => 'lint/linter/ArcanistRuboCopLinter.php',
'ArcanistRuboCopLinterTestCase' => 'lint/linter/__tests__/ArcanistRuboCopLinterTestCase.php',
@@ -521,7 +515,6 @@
'ArcanistWorkingCopyPath' => 'workingcopy/ArcanistWorkingCopyPath.php',
'ArcanistWorkingCopyStateRef' => 'ref/ArcanistWorkingCopyStateRef.php',
'ArcanistWorkingCopyStateRefInspector' => 'inspector/ArcanistWorkingCopyStateRefInspector.php',
- 'ArcanistWorkingCopyStateRefPro' => 'ref/ArcanistWorkingCopyStateRefPro.php',
'ArcanistXHPASTLintNamingHook' => 'lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php',
'ArcanistXHPASTLintNamingHookTestCase' => 'lint/linter/xhpast/__tests__/ArcanistXHPASTLintNamingHookTestCase.php',
'ArcanistXHPASTLintSwitchHook' => 'lint/linter/xhpast/ArcanistXHPASTLintSwitchHook.php',
@@ -1037,7 +1030,6 @@
'ArcanistBraceFormattingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistBranchRef' => 'ArcanistRef',
- 'ArcanistBranchRefPro' => 'ArcanistRefPro',
'ArcanistBranchWorkflow' => 'ArcanistFeatureWorkflow',
'ArcanistBrowseCommitHardpointLoader' => 'ArcanistHardpointLoader',
'ArcanistBrowseCommitHardpointQuery' => 'ArcanistWorkflowHardpointQuery',
@@ -1049,13 +1041,11 @@
'ArcanistBrowsePathURIHardpointQuery' => 'ArcanistBrowseURIHardpointQuery',
'ArcanistBrowseRef' => 'ArcanistRef',
'ArcanistBrowseRefInspector' => 'ArcanistRefInspector',
- 'ArcanistBrowseRefPro' => 'ArcanistRefPro',
'ArcanistBrowseRevisionURIHardpointLoader' => 'ArcanistBrowseURIHardpointLoader',
'ArcanistBrowseRevisionURIHardpointQuery' => 'ArcanistBrowseURIHardpointQuery',
'ArcanistBrowseURIHardpointLoader' => 'ArcanistHardpointLoader',
'ArcanistBrowseURIHardpointQuery' => 'ArcanistWorkflowHardpointQuery',
'ArcanistBrowseURIRef' => 'ArcanistRef',
- 'ArcanistBrowseURIRefPro' => 'ArcanistRefPro',
'ArcanistBrowseWorkflow' => 'ArcanistArcWorkflow',
'ArcanistBuildPlanRef' => 'Phobject',
'ArcanistBuildRef' => 'Phobject',
@@ -1096,7 +1086,6 @@
'ArcanistCommentStyleXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistCommitRef' => 'ArcanistRef',
'ArcanistCommitRefInspector' => 'ArcanistRefInspector',
- 'ArcanistCommitRefPro' => 'ArcanistRefPro',
'ArcanistCommitUpstreamHardpointLoader' => 'ArcanistHardpointLoader',
'ArcanistCommitUpstreamHardpointQuery' => 'ArcanistWorkflowHardpointQuery',
'ArcanistCommitWorkflow' => 'ArcanistWorkflow',
@@ -1382,9 +1371,8 @@
'ArcanistPyLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
'ArcanistRaggedClassTreeEdgeXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
- 'ArcanistRef' => 'Phobject',
+ 'ArcanistRef' => 'ArcanistHardpointObject',
'ArcanistRefInspector' => 'Phobject',
- 'ArcanistRefPro' => 'ArcanistHardpointObject',
'ArcanistRefQuery' => 'Phobject',
'ArcanistRepositoryAPI' => 'Phobject',
'ArcanistRepositoryAPIMiscTestCase' => 'PhutilTestCase',
@@ -1398,7 +1386,6 @@
'ArcanistReusedIteratorXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistRevertWorkflow' => 'ArcanistWorkflow',
'ArcanistRevisionRef' => 'ArcanistRef',
- 'ArcanistRevisionRefPro' => 'ArcanistRefPro',
'ArcanistRevisionRefSource' => 'Phobject',
'ArcanistRuboCopLinter' => 'ArcanistExternalLinter',
'ArcanistRuboCopLinterTestCase' => 'ArcanistExternalLinterTestCase',
@@ -1503,7 +1490,6 @@
'ArcanistWorkingCopyPath' => 'Phobject',
'ArcanistWorkingCopyStateRef' => 'ArcanistRef',
'ArcanistWorkingCopyStateRefInspector' => 'ArcanistRefInspector',
- 'ArcanistWorkingCopyStateRefPro' => 'ArcanistRefPro',
'ArcanistXHPASTLintNamingHook' => 'Phobject',
'ArcanistXHPASTLintNamingHookTestCase' => 'PhutilTestCase',
'ArcanistXHPASTLintSwitchHook' => 'Phobject',
diff --git a/src/browse/loader/ArcanistBrowseURIHardpointLoader.php b/src/browse/loader/ArcanistBrowseURIHardpointLoader.php
--- a/src/browse/loader/ArcanistBrowseURIHardpointLoader.php
+++ b/src/browse/loader/ArcanistBrowseURIHardpointLoader.php
@@ -19,10 +19,6 @@
return ($hardpoint == 'uris');
}
- public function willLoadBrowseURIRefs(array $refs) {
- return;
- }
-
public function didFailToLoadBrowseURIRefs(array $refs) {
return;
}
diff --git a/src/browse/query/ArcanistBrowseCommitHardpointQuery.php b/src/browse/query/ArcanistBrowseCommitHardpointQuery.php
--- a/src/browse/query/ArcanistBrowseCommitHardpointQuery.php
+++ b/src/browse/query/ArcanistBrowseCommitHardpointQuery.php
@@ -5,12 +5,12 @@
public function getHardpoints() {
return array(
- ArcanistBrowseRefPro::HARDPOINT_COMMITREFS,
+ ArcanistBrowseRef::HARDPOINT_COMMITREFS,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistBrowseRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistBrowseRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
@@ -53,7 +53,7 @@
$results = array();
foreach ($commit_map as $commit_identifier => $ref_keys) {
foreach ($ref_keys as $key) {
- $commit_ref = id(new ArcanistCommitRefPro())
+ $commit_ref = id(new ArcanistCommitRef())
->setCommitHash($commit_identifier);
$results[$key][] = $commit_ref;
}
diff --git a/src/browse/query/ArcanistBrowseCommitURIHardpointQuery.php b/src/browse/query/ArcanistBrowseCommitURIHardpointQuery.php
--- a/src/browse/query/ArcanistBrowseCommitURIHardpointQuery.php
+++ b/src/browse/query/ArcanistBrowseCommitURIHardpointQuery.php
@@ -5,33 +5,6 @@
const BROWSETYPE = 'commit';
- public function willLoadBrowseURIRefs(array $refs) {
- $refs = $this->getRefsWithSupportedTypes($refs);
-
- if (!$refs) {
- return;
- }
-
- $query = $this->getQuery();
-
- $working_ref = $query->getWorkingCopyRef();
- if (!$working_ref) {
- // If we aren't in a working copy, don't warn about this.
- return;
- }
-
- $repository_ref = $this->getQuery()->getRepositoryRef();
- if (!$repository_ref) {
- echo pht(
- 'NO REPOSITORY: Unable to determine which repository this working '.
- 'copy belongs to, so arguments can not be resolved as commits. Use '.
- '"%s" to understand how repositories are resolved.',
- 'arc which');
- echo "\n";
- return;
- }
- }
-
public function loadHardpoint(array $refs, $hardpoint) {
$refs = $this->getRefsWithSupportedTypes($refs);
if (!$refs) {
@@ -41,7 +14,7 @@
yield $this->yieldRequests(
$refs,
array(
- ArcanistBrowseRefPro::HARDPOINT_COMMITREFS,
+ ArcanistBrowseRef::HARDPOINT_COMMITREFS,
));
$commit_refs = array();
@@ -54,7 +27,7 @@
yield $this->yieldRequests(
$commit_refs,
array(
- ArcanistCommitRefPro::HARDPOINT_UPSTREAM,
+ ArcanistCommitRef::HARDPOINT_UPSTREAM,
));
$results = array();
diff --git a/src/browse/query/ArcanistBrowsePathURIHardpointQuery.php b/src/browse/query/ArcanistBrowsePathURIHardpointQuery.php
--- a/src/browse/query/ArcanistBrowsePathURIHardpointQuery.php
+++ b/src/browse/query/ArcanistBrowsePathURIHardpointQuery.php
@@ -5,60 +5,6 @@
const BROWSETYPE = 'path';
- public function willLoadBrowseURIRefs(array $refs) {
- $refs = $this->getRefsWithSupportedTypes($refs);
- if (!$refs) {
- return;
- }
-
- $query = $this->getQuery();
-
- $working_ref = $query->getWorkingCopyRef();
- if (!$working_ref) {
- echo pht(
- 'NO WORKING COPY: The current directory is not a repository '.
- 'working copy, so arguments can not be resolved as paths. Run '.
- 'this command inside a working copy to resolve paths.');
- echo "\n";
- return;
- }
-
- $repository_ref = $query->getRepositoryRef();
- if (!$repository_ref) {
- echo pht(
- 'NO REPOSITORY: Unable to determine which repository this working '.
- 'copy belongs to, so arguments can not be resolved as paths. Use '.
- '"%s" to understand how repositories are resolved.',
- 'arc which');
- echo "\n";
- return;
- }
- }
-
- public function didFailToLoadBrowseURIRefs(array $refs) {
- $refs = $this->getRefsWithSupportedTypes($refs);
- if (!$refs) {
- return;
- }
-
- $query = $this->getQuery();
-
- $working_ref = $query->getWorkingCopyRef();
- if (!$working_ref) {
- return;
- }
-
- $repository_ref = $query->getRepositoryRef();
- if (!$repository_ref) {
- return;
- }
-
- echo pht(
- 'Use "--types path" to force arguments to be interpreted as paths.');
- echo "\n";
- }
-
-
public function loadHardpoint(array $refs, $hardpoint) {
$refs = $this->getRefsWithSupportedTypes($refs);
if (!$refs) {
diff --git a/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php b/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php
--- a/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php
+++ b/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php
@@ -14,7 +14,7 @@
yield $this->yieldRequests(
$refs,
array(
- ArcanistBrowseRefPro::HARDPOINT_COMMITREFS,
+ ArcanistBrowseRef::HARDPOINT_COMMITREFS,
));
$states = array();
@@ -22,7 +22,7 @@
foreach ($refs as $key => $ref) {
foreach ($ref->getCommitRefs() as $commit_ref) {
$hash = $commit_ref->getCommitHash();
- $states[$hash] = id(new ArcanistWorkingCopyStateRefPro())
+ $states[$hash] = id(new ArcanistWorkingCopyStateRef())
->setCommitRef($commit_ref);
$map[$hash][] = $key;
}
diff --git a/src/browse/query/ArcanistBrowseURIHardpointQuery.php b/src/browse/query/ArcanistBrowseURIHardpointQuery.php
--- a/src/browse/query/ArcanistBrowseURIHardpointQuery.php
+++ b/src/browse/query/ArcanistBrowseURIHardpointQuery.php
@@ -9,12 +9,12 @@
public function getHardpoints() {
return array(
- ArcanistBrowseRefPro::HARDPOINT_URIS,
+ ArcanistBrowseRef::HARDPOINT_URIS,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistBrowseRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistBrowseRef);
}
public function getRefsWithSupportedTypes(array $refs) {
@@ -42,7 +42,7 @@
}
final protected function newBrowseURIRef() {
- return id(new ArcanistBrowseURIRefPro())
+ return id(new ArcanistBrowseURIRef())
->setType($this->getSupportedBrowseType());
}
diff --git a/src/browse/ref/ArcanistBrowseRef.php b/src/browse/ref/ArcanistBrowseRef.php
--- a/src/browse/ref/ArcanistBrowseRef.php
+++ b/src/browse/ref/ArcanistBrowseRef.php
@@ -3,24 +3,21 @@
final class ArcanistBrowseRef
extends ArcanistRef {
+ const HARDPOINT_URIS = 'uris';
+ const HARDPOINT_COMMITREFS = 'commitRefs';
+
private $token;
- private $types;
+ private $types = array();
private $branch;
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
return pht('Browse Query "%s"', $this->getToken());
}
- public function defineHardpoints() {
+ protected function newHardpoints() {
return array(
- 'commitRefs' => array(
- 'type' => 'ArcanistCommitRef',
- 'vector' => true,
- ),
- 'uris' => array(
- 'type' => 'ArcanistBrowseURIRef',
- 'vector' => true,
- ),
+ $this->newVectorHardpoint(self::HARDPOINT_COMMITREFS),
+ $this->newVectorHardpoint(self::HARDPOINT_URIS),
);
}
@@ -62,11 +59,11 @@
}
public function getURIs() {
- return $this->getHardpoint('uris');
+ return $this->getHardpoint(self::HARDPOINT_URIS);
}
public function getCommitRefs() {
- return $this->getHardpoint('commitRefs');
+ return $this->getHardpoint(self::HARDPOINT_COMMITREFS);
}
}
diff --git a/src/browse/ref/ArcanistBrowseRefPro.php b/src/browse/ref/ArcanistBrowseRefPro.php
deleted file mode 100644
--- a/src/browse/ref/ArcanistBrowseRefPro.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-final class ArcanistBrowseRefPro
- extends ArcanistRefPro {
-
- const HARDPOINT_URIS = 'uris';
- const HARDPOINT_COMMITREFS = 'commitRefs';
-
- private $token;
- private $types = array();
- private $branch;
-
- public function getRefDisplayName() {
- return pht('Browse Query "%s"', $this->getToken());
- }
-
- protected function newHardpoints() {
- return array(
- $this->newVectorHardpoint(self::HARDPOINT_COMMITREFS),
- $this->newVectorHardpoint(self::HARDPOINT_URIS),
- );
- }
-
- public function setToken($token) {
- $this->token = $token;
- return $this;
- }
-
- public function getToken() {
- return $this->token;
- }
-
- public function setTypes(array $types) {
- $this->types = $types;
- return $this;
- }
-
- public function getTypes() {
- return $this->types;
- }
-
- public function hasType($type) {
- $map = $this->getTypes();
- $map = array_fuse($map);
- return isset($map[$type]);
- }
-
- public function isUntyped() {
- return !$this->types;
- }
-
- public function setBranch($branch) {
- $this->branch = $branch;
- return $this;
- }
-
- public function getBranch() {
- return $this->branch;
- }
-
- public function getURIs() {
- return $this->getHardpoint(self::HARDPOINT_URIS);
- }
-
- public function getCommitRefs() {
- return $this->getHardpoint(self::HARDPOINT_COMMITREFS);
- }
-
-}
diff --git a/src/browse/ref/ArcanistBrowseURIRef.php b/src/browse/ref/ArcanistBrowseURIRef.php
--- a/src/browse/ref/ArcanistBrowseURIRef.php
+++ b/src/browse/ref/ArcanistBrowseURIRef.php
@@ -6,7 +6,7 @@
private $uri;
private $type;
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
return pht('Browse URI "%s"', $this->getURI());
}
diff --git a/src/browse/ref/ArcanistBrowseURIRefPro.php b/src/browse/ref/ArcanistBrowseURIRefPro.php
deleted file mode 100644
--- a/src/browse/ref/ArcanistBrowseURIRefPro.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-final class ArcanistBrowseURIRefPro
- extends ArcanistRefPro {
-
- private $uri;
- private $type;
-
- public function getRefDisplayName() {
- return pht('Browse URI "%s"', $this->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/browse/workflow/ArcanistBrowseWorkflow.php b/src/browse/workflow/ArcanistBrowseWorkflow.php
--- a/src/browse/workflow/ArcanistBrowseWorkflow.php
+++ b/src/browse/workflow/ArcanistBrowseWorkflow.php
@@ -107,23 +107,22 @@
}
}
- $loaders = ArcanistBrowseURIHardpointLoader::getAllBrowseLoaders();
- foreach ($loaders as $key => $loader) {
- $loaders[$key] = clone $loader;
- }
+ // TODO: The "Path" and "Commit" queries should regain the ability to warn
+ // when this command is not run in a working copy that belongs to a
+ // recognized repository, so they won't ever be able to resolve things.
- $query = $this->newRefQuery($refs)
- ->needHardpoints(
- array(
- 'uris',
- ))
- ->setLoaders($loaders);
+ // TODO: When you run "arc browse" with no arguments, we should either
+ // take you to the repository home page or show help.
- foreach ($loaders as $loader) {
- $loader->willLoadBrowseURIRefs($refs);
- }
+ // TODO: When you "arc browse something/like/a/path.c" but it does not
+ // exist on disk, it is not resolved unless you explicitly use "--type
+ // path". This should be explained more clearly again.
- $query->execute();
+ $this->loadHardpoints(
+ $refs,
+ array(
+ ArcanistBrowseRef::HARDPOINT_URIS,
+ ));
$zero_hits = array();
$open_uris = array();
@@ -221,10 +220,6 @@
$ref->getToken()));
}
}
-
- foreach ($loaders as $loader) {
- $loader->didFailToLoadBrowseURIRefs($refs);
- }
}
$uris = array();
diff --git a/src/inspector/ArcanistBrowseRefInspector.php b/src/inspector/ArcanistBrowseRefInspector.php
--- a/src/inspector/ArcanistBrowseRefInspector.php
+++ b/src/inspector/ArcanistBrowseRefInspector.php
@@ -15,7 +15,7 @@
'token.'));
}
- return id(new ArcanistBrowseRefPro())
+ return id(new ArcanistBrowseRef())
->setToken($argv[0]);
}
diff --git a/src/inspector/ArcanistCommitRefInspector.php b/src/inspector/ArcanistCommitRefInspector.php
--- a/src/inspector/ArcanistCommitRefInspector.php
+++ b/src/inspector/ArcanistCommitRefInspector.php
@@ -15,7 +15,7 @@
'commit hash.'));
}
- return id(new ArcanistCommitRefPro())
+ return id(new ArcanistCommitRef())
->setCommitHash($argv[0]);
}
diff --git a/src/inspector/ArcanistWorkingCopyStateRefInspector.php b/src/inspector/ArcanistWorkingCopyStateRefInspector.php
--- a/src/inspector/ArcanistWorkingCopyStateRefInspector.php
+++ b/src/inspector/ArcanistWorkingCopyStateRefInspector.php
@@ -16,10 +16,10 @@
}
$commit_hash = $argv[0];
- $commit_ref = id(new ArcanistCommitRefPro())
+ $commit_ref = id(new ArcanistCommitRef())
->setCommitHash($commit_hash);
- return id(new ArcanistWorkingCopyStateRefPro())
+ return id(new ArcanistWorkingCopyStateRef())
->setCommitRef($commit_ref);
}
diff --git a/src/query/ArcanistCommitUpstreamHardpointQuery.php b/src/query/ArcanistCommitUpstreamHardpointQuery.php
--- a/src/query/ArcanistCommitUpstreamHardpointQuery.php
+++ b/src/query/ArcanistCommitUpstreamHardpointQuery.php
@@ -5,12 +5,12 @@
public function getHardpoints() {
return array(
- ArcanistCommitRefPro::HARDPOINT_UPSTREAM,
+ ArcanistCommitRef::HARDPOINT_UPSTREAM,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistCommitRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistCommitRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
diff --git a/src/query/ArcanistGitCommitMessageHardpointQuery.php b/src/query/ArcanistGitCommitMessageHardpointQuery.php
--- a/src/query/ArcanistGitCommitMessageHardpointQuery.php
+++ b/src/query/ArcanistGitCommitMessageHardpointQuery.php
@@ -5,12 +5,12 @@
public function getHardpoints() {
return array(
- ArcanistCommitRefPro::HARDPOINT_MESSAGE,
+ ArcanistCommitRef::HARDPOINT_MESSAGE,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistCommitRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistCommitRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
diff --git a/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php b/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
--- a/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
+++ b/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
@@ -5,19 +5,19 @@
public function getHardpoints() {
return array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_REVISIONREFS,
+ ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistWorkingCopyStateRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistWorkingCopyStateRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
yield $this->yieldRequests(
$refs,
array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_COMMITREF,
+ ArcanistWorkingCopyStateRef::HARDPOINT_COMMITREF,
));
$hashes = array();
@@ -60,7 +60,7 @@
continue;
}
- $revision_ref = ArcanistRevisionRefPro::newFromConduit($dict);
+ $revision_ref = ArcanistRevisionRef::newFromConduit($dict);
foreach ($revision_hashes as $revision_hash) {
$hash_key = $this->getHashKey($revision_hash);
$state_refs = idx($map, $hash_key, array());
diff --git a/src/query/ArcanistMessageRevisionHardpointQuery.php b/src/query/ArcanistMessageRevisionHardpointQuery.php
--- a/src/query/ArcanistMessageRevisionHardpointQuery.php
+++ b/src/query/ArcanistMessageRevisionHardpointQuery.php
@@ -5,19 +5,19 @@
public function getHardpoints() {
return array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_REVISIONREFS,
+ ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistWorkingCopyStateRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistWorkingCopyStateRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
yield $this->yieldRequests(
$refs,
array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_COMMITREF,
+ ArcanistWorkingCopyStateRef::HARDPOINT_COMMITREF,
));
$commit_refs = array();
@@ -28,7 +28,7 @@
yield $this->yieldRequests(
$commit_refs,
array(
- ArcanistCommitRefPro::HARDPOINT_MESSAGE,
+ ArcanistCommitRef::HARDPOINT_MESSAGE,
));
$map = array();
@@ -60,7 +60,7 @@
)));
foreach ($revisions as $dict) {
- $revision_ref = ArcanistRevisionRefPro::newFromConduit($dict);
+ $revision_ref = ArcanistRevisionRef::newFromConduit($dict);
$id = $dict['id'];
$state_refs = idx($map, $id, array());
diff --git a/src/query/ArcanistWorkingCopyCommitHardpointQuery.php b/src/query/ArcanistWorkingCopyCommitHardpointQuery.php
--- a/src/query/ArcanistWorkingCopyCommitHardpointQuery.php
+++ b/src/query/ArcanistWorkingCopyCommitHardpointQuery.php
@@ -5,19 +5,19 @@
public function getHardpoints() {
return array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_COMMITREF,
+ ArcanistWorkingCopyStateRef::HARDPOINT_COMMITREF,
);
}
- protected function canLoadRef(ArcanistRefPro $ref) {
- return ($ref instanceof ArcanistWorkingCopyStateRefPro);
+ protected function canLoadRef(ArcanistRef $ref) {
+ return ($ref instanceof ArcanistWorkingCopyStateRef);
}
public function loadHardpoint(array $refs, $hardpoint) {
yield $this->yieldRequests(
$refs,
array(
- ArcanistWorkingCopyStateRefPro::HARDPOINT_BRANCHREF,
+ ArcanistWorkingCopyStateRef::HARDPOINT_BRANCHREF,
));
$branch_refs = mpull($refs, 'getBranchRef');
@@ -25,7 +25,7 @@
yield $this->yieldRequests(
$branch_refs,
array(
- ArcanistBranchRefPro::HARDPOINT_COMMITREF,
+ ArcanistBranchRef::HARDPOINT_COMMITREF,
));
$results = array();
diff --git a/src/ref/ArcanistBranchRef.php b/src/ref/ArcanistBranchRef.php
--- a/src/ref/ArcanistBranchRef.php
+++ b/src/ref/ArcanistBranchRef.php
@@ -3,19 +3,19 @@
final class ArcanistBranchRef
extends ArcanistRef {
+ const HARDPOINT_COMMITREF = 'commitRef';
+
private $branchName;
private $refName;
private $isCurrentBranch;
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
return pht('Branch %s', $this->getBranchName());
}
- public function defineHardpoints() {
+ protected function newHardpoints() {
return array(
- 'commitRef' => array(
- 'type' => 'ArcanistCommitRef',
- ),
+ $this->newHardpoint(self::HARDPOINT_COMMITREF),
);
}
@@ -47,11 +47,11 @@
}
public function attachCommitRef(ArcanistCommitRef $ref) {
- return $this->attachHardpoint('commitRef', $ref);
+ return $this->attachHardpoint(self::HARDPOINT_COMMITREF, $ref);
}
public function getCommitRef() {
- return $this->getHardpoint('commitRef');
+ return $this->getHardpoint(self::HARDPOINT_COMMITREF);
}
}
diff --git a/src/ref/ArcanistBranchRefPro.php b/src/ref/ArcanistBranchRefPro.php
deleted file mode 100644
--- a/src/ref/ArcanistBranchRefPro.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-final class ArcanistBranchRefPro
- extends ArcanistRefPro {
-
- const HARDPOINT_COMMITREF = 'commitRef';
-
- private $branchName;
- private $refName;
- private $isCurrentBranch;
-
- public function getRefDisplayName() {
- return pht('Branch %s', $this->getBranchName());
- }
-
- protected function newHardpoints() {
- return array(
- $this->newHardpoint(self::HARDPOINT_COMMITREF),
- );
- }
-
- public function setBranchName($branch_name) {
- $this->branchName = $branch_name;
- return $this;
- }
-
- public function getBranchName() {
- return $this->branchName;
- }
-
- public function setRefName($ref_name) {
- $this->refName = $ref_name;
- return $this;
- }
-
- public function getRefName() {
- return $this->refName;
- }
-
- public function setIsCurrentBranch($is_current_branch) {
- $this->isCurrentBranch = $is_current_branch;
- return $this;
- }
-
- public function getIsCurrentBranch() {
- return $this->isCurrentBranch;
- }
-
- public function attachCommitRef(ArcanistCommitRef $ref) {
- return $this->attachHardpoint(self::HARDPOINT_COMMITREF, $ref);
- }
-
- public function getCommitRef() {
- return $this->getHardpoint(self::HARDPOINT_COMMITREF);
- }
-
-}
diff --git a/src/ref/ArcanistCommitRef.php b/src/ref/ArcanistCommitRef.php
--- a/src/ref/ArcanistCommitRef.php
+++ b/src/ref/ArcanistCommitRef.php
@@ -9,18 +9,17 @@
private $authorEpoch;
private $upstream;
- public function getRefIdentifier() {
- return pht('Commit %s', $this->getCommitHash());
+ const HARDPOINT_MESSAGE = 'message';
+ const HARDPOINT_UPSTREAM = 'upstream';
+
+ public function getRefDisplayName() {
+ return pht('Commit "%s"', $this->getCommitHash());
}
- public function defineHardpoints() {
+ protected function newHardpoints() {
return array(
- 'message' => array(
- 'type' => 'string',
- ),
- 'upstream' => array(
- 'type' => 'wild',
- ),
+ $this->newHardpoint(self::HARDPOINT_MESSAGE),
+ $this->newHardpoint(self::HARDPOINT_UPSTREAM),
);
}
@@ -70,11 +69,11 @@
}
public function attachMessage($message) {
- return $this->attachHardpoint('message', $message);
+ return $this->attachHardpoint(self::HARDPOINT_MESSAGE, $message);
}
public function getMessage() {
- return $this->getHardpoint('message');
+ return $this->getHardpoint(self::HARDPOINT_MESSAGE);
}
public function getURI() {
@@ -82,7 +81,7 @@
}
private function getUpstreamProperty($key, $default = null) {
- $upstream = $this->getHardpoint('upstream');
+ $upstream = $this->getHardpoint(self::HARDPOINT_UPSTREAM);
if (!$upstream) {
return $default;
diff --git a/src/ref/ArcanistCommitRefPro.php b/src/ref/ArcanistCommitRefPro.php
deleted file mode 100644
--- a/src/ref/ArcanistCommitRefPro.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-final class ArcanistCommitRefPro
- extends ArcanistRefPro {
-
- private $commitHash;
- private $treeHash;
- private $commitEpoch;
- private $authorEpoch;
- private $upstream;
-
- const HARDPOINT_MESSAGE = 'message';
- const HARDPOINT_UPSTREAM = 'upstream';
-
- public function getRefDisplayName() {
- return pht('Commit "%s"', $this->getCommitHash());
- }
-
- protected function newHardpoints() {
- return array(
- $this->newHardpoint(self::HARDPOINT_MESSAGE),
- $this->newHardpoint(self::HARDPOINT_UPSTREAM),
- );
- }
-
- public function setCommitHash($commit_hash) {
- $this->commitHash = $commit_hash;
- return $this;
- }
-
- public function getCommitHash() {
- return $this->commitHash;
- }
-
- public function setTreeHash($tree_hash) {
- $this->treeHash = $tree_hash;
- return $this;
- }
-
- public function getTreeHash() {
- return $this->treeHash;
- }
-
- public function setCommitEpoch($commit_epoch) {
- $this->commitEpoch = $commit_epoch;
- return $this;
- }
-
- public function getCommitEpoch() {
- return $this->commitEpoch;
- }
-
- public function setAuthorEpoch($author_epoch) {
- $this->authorEpoch = $author_epoch;
- return $this;
- }
-
- public function getAuthorEpoch() {
- return $this->authorEpoch;
- }
-
- public function getSummary() {
- $message = $this->getMessage();
-
- $message = trim($message);
- $lines = phutil_split_lines($message, false);
-
- return head($lines);
- }
-
- public function attachMessage($message) {
- return $this->attachHardpoint(self::HARDPOINT_MESSAGE, $message);
- }
-
- public function getMessage() {
- return $this->getHardpoint(self::HARDPOINT_MESSAGE);
- }
-
- public function getURI() {
- return $this->getUpstreamProperty('uri');
- }
-
- private function getUpstreamProperty($key, $default = null) {
- $upstream = $this->getHardpoint(self::HARDPOINT_UPSTREAM);
-
- if (!$upstream) {
- return $default;
- }
-
- return idx($upstream, $key, $default);
- }
-
-}
diff --git a/src/ref/ArcanistRef.php b/src/ref/ArcanistRef.php
--- a/src/ref/ArcanistRef.php
+++ b/src/ref/ArcanistRef.php
@@ -1,106 +1,8 @@
<?php
abstract class ArcanistRef
- extends Phobject {
+ extends ArcanistHardpointObject {
- private $hardpoints = array();
-
- abstract public function getRefIdentifier();
- abstract public function defineHardpoints();
-
- final public function hasHardpoint($hardpoint) {
- $map = $this->getHardpointMap();
- return isset($map[$hardpoint]);
- }
-
- final public function hasAttachedHardpoint($hardpoint) {
- if (array_key_exists($hardpoint, $this->hardpoints)) {
- return true;
- }
-
- return $this->canReadHardpoint($hardpoint);
- }
-
- final public function attachHardpoint($hardpoint, $value) {
- if (!$this->hasHardpoint($hardpoint)) {
- throw new Exception(pht('No hardpoint "%s".', $hardpoint));
- }
-
- $this->hardpoints[$hardpoint] = $value;
-
- return $this;
- }
-
- final public function appendHardpoint($hardpoint, array $value) {
- if (!$this->isVectorHardpoint($hardpoint)) {
- throw new Exception(
- pht(
- 'Hardpoint "%s" is not a vector hardpoint.',
- $hardpoint));
- }
-
- if (!isset($this->hardpoints[$hardpoint])) {
- $this->hardpoints[$hardpoint] = array();
- }
-
- $this->hardpoints[$hardpoint] = $this->mergeHardpoint(
- $hardpoint,
- $this->hardpoints[$hardpoint],
- $value);
-
- return $this;
- }
-
- protected function mergeHardpoint($hardpoint, array $src, array $new) {
- foreach ($new as $value) {
- $src[] = $value;
- }
- return $src;
- }
-
- final public function isVectorHardpoint($hardpoint) {
- if (!$this->hasHardpoint($hardpoint)) {
- return false;
- }
-
- $map = $this->getHardpointMap();
- $spec = idx($map, $hardpoint, array());
-
- return (idx($spec, 'vector') === true);
- }
-
- final public function getHardpoint($hardpoint) {
- if (!$this->hasAttachedHardpoint($hardpoint)) {
- if (!$this->hasHardpoint($hardpoint)) {
- throw new Exception(
- pht(
- 'Ref does not have hardpoint "%s"!',
- $hardpoint));
- } else {
- throw new Exception(
- pht(
- 'Hardpoint "%s" is not attached!',
- $hardpoint));
- }
- }
-
- if (array_key_exists($hardpoint, $this->hardpoints)) {
- return $this->hardpoints[$hardpoint];
- }
-
- return $this->readHardpoint($hardpoint);
- }
-
- private function getHardpointMap() {
- return $this->defineHardpoints();
- }
-
- protected function canReadHardpoint($hardpoint) {
- return false;
- }
-
- protected function readHardpoint($hardpoint) {
- throw new Exception(pht('Can not read hardpoint "%s".', $hardpoint));
- }
+ abstract public function getRefDisplayName();
}
diff --git a/src/ref/ArcanistRefPro.php b/src/ref/ArcanistRefPro.php
deleted file mode 100644
--- a/src/ref/ArcanistRefPro.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-abstract class ArcanistRefPro
- extends ArcanistHardpointObject {
-
- abstract public function getRefDisplayName();
-
-}
diff --git a/src/ref/ArcanistRepositoryRef.php b/src/ref/ArcanistRepositoryRef.php
--- a/src/ref/ArcanistRepositoryRef.php
+++ b/src/ref/ArcanistRepositoryRef.php
@@ -6,7 +6,7 @@
private $phid;
private $browseURI;
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
return pht('Remote Repository');
}
diff --git a/src/ref/ArcanistRevisionRef.php b/src/ref/ArcanistRevisionRef.php
--- a/src/ref/ArcanistRevisionRef.php
+++ b/src/ref/ArcanistRevisionRef.php
@@ -6,7 +6,7 @@
private $parameters;
private $sources = array();
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
return pht('Revision %s', $this->getMonogram());
}
@@ -52,6 +52,10 @@
return idx($this->parameters, 'id');
}
+ public function getPHID() {
+ return idx($this->parameters, 'phid');
+ }
+
public function getName() {
return idx($this->parameters, 'title');
}
diff --git a/src/ref/ArcanistRevisionRefPro.php b/src/ref/ArcanistRevisionRefPro.php
deleted file mode 100644
--- a/src/ref/ArcanistRevisionRefPro.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-final class ArcanistRevisionRefPro
- extends ArcanistRefPro {
-
- private $parameters;
- private $sources = array();
-
- public function getRefDisplayName() {
- return pht('Revision %s', $this->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;
- }
-
-}
diff --git a/src/ref/ArcanistWorkingCopyStateRef.php b/src/ref/ArcanistWorkingCopyStateRef.php
--- a/src/ref/ArcanistWorkingCopyStateRef.php
+++ b/src/ref/ArcanistWorkingCopyStateRef.php
@@ -3,56 +3,34 @@
final class ArcanistWorkingCopyStateRef
extends ArcanistRef {
- private $rootDirectory;
+ const HARDPOINT_COMMITREF = 'commitRef';
+ const HARDPOINT_REVISIONREFS = 'revisionRefs';
- public function getRefIdentifier() {
+ public function getRefDisplayName() {
// TODO: This could check attached hardpoints and render something more
// insightful.
return pht('Working Copy State');
}
- public function defineHardpoints() {
+ protected function newHardpoints() {
+ $object_list = new ArcanistObjectListHardpoint();
return array(
- 'commitRef' => array(
- 'type' => 'ArcanistCommitRef',
- ),
- 'branchRef' => array(
- 'type' => 'ArcanistBranchRef',
- ),
- 'revisionRefs' => array(
- 'type' => 'ArcanistRevisionRef',
- 'vector' => true,
- ),
+ $this->newHardpoint(self::HARDPOINT_COMMITREF),
+ $this->newTemplateHardpoint(self::HARDPOINT_REVISIONREFS, $object_list),
);
}
- public function setRootDirectory($root_directory) {
- $this->rootDirectory = $root_directory;
- return $this;
- }
-
- public function getRootDirectory() {
- return $this->rootDirectory;
- }
-
- public function attachBranchRef(ArcanistBranchRef $branch_ref) {
- return $this->attachHardpoint('branchRef', $branch_ref);
- }
-
- public function getBranchRef() {
- return $this->getHardpoint('branchRef');
- }
-
+ // TODO: This should be "attachCommitRef()".
public function setCommitRef(ArcanistCommitRef $commit_ref) {
- return $this->attachHardpoint('commitRef', $commit_ref);
+ return $this->attachHardpoint(self::HARDPOINT_COMMITREF, $commit_ref);
}
public function getCommitRef() {
- return $this->getHardpoint('commitRef');
+ return $this->getHardpoint(self::HARDPOINT_COMMITREF);
}
public function getRevisionRefs() {
- return $this->getHardpoint('revisionRefs');
+ return $this->getHardpoint(self::HARDPOINT_REVISIONREFS);
}
public function getRevisionRef() {
@@ -73,50 +51,4 @@
return (count($this->getRevisionRefs()) > 1);
}
- protected function canReadHardpoint($hardpoint) {
- switch ($hardpoint) {
- case 'commitRef':
- // If we have a branch ref, we can try to read the commit ref from the
- // branch ref.
- if ($this->hasAttachedHardpoint('branchRef')) {
- if ($this->getBranchRef()->hasAttachedHardpoint('commitRef')) {
- return true;
- }
- }
- break;
- }
-
- return false;
- }
-
- protected function readHardpoint($hardpoint) {
- switch ($hardpoint) {
- case 'commitRef':
- return $this->getBranchRef()->getCommitRef();
- }
-
- return parent::readHardpoint($hardpoint);
- }
-
- protected function mergeHardpoint($hardpoint, array $src, array $new) {
- if ($hardpoint == 'revisionRefs') {
- $src = mpull($src, null, 'getID');
- $new = mpull($new, null, 'getID');
-
- foreach ($new as $id => $ref) {
- if (isset($src[$id])) {
- foreach ($ref->getSources() as $source) {
- $src[$id]->addSource($source);
- }
- } else {
- $src[$id] = $ref;
- }
- }
-
- return array_values($src);
- }
-
- return parent::mergeHardpoint($hardpoint, $src, $new);
- }
-
}
diff --git a/src/ref/ArcanistWorkingCopyStateRefPro.php b/src/ref/ArcanistWorkingCopyStateRefPro.php
deleted file mode 100644
--- a/src/ref/ArcanistWorkingCopyStateRefPro.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-final class ArcanistWorkingCopyStateRefPro
- extends ArcanistRefPro {
-
- const HARDPOINT_COMMITREF = 'commitRef';
- const HARDPOINT_REVISIONREFS = 'revisionRefs';
-
- public function getRefDisplayName() {
- // TODO: This could check attached hardpoints and render something more
- // insightful.
- return pht('Working Copy State');
- }
-
- protected function newHardpoints() {
- $object_list = new ArcanistObjectListHardpoint();
- return array(
- $this->newHardpoint(self::HARDPOINT_COMMITREF),
- $this->newTemplateHardpoint(self::HARDPOINT_REVISIONREFS, $object_list),
- );
- }
-
- // TODO: This should be "attachCommitRef()".
- public function setCommitRef(ArcanistCommitRefPro $commit_ref) {
- return $this->attachHardpoint(self::HARDPOINT_COMMITREF, $commit_ref);
- }
-
- public function getCommitRef() {
- return $this->getHardpoint(self::HARDPOINT_COMMITREF);
- }
-
- public function getRevisionRefs() {
- return $this->getHardpoint(self::HARDPOINT_REVISIONREFS);
- }
-
- public function getRevisionRef() {
- if ($this->hasAmbiguousRevisionRefs()) {
- throw new Exception(
- pht('State has multiple ambiguous revisions refs.'));
- }
-
- $refs = $this->getRevisionRefs();
- if ($refs) {
- return head($refs);
- }
-
- return null;
- }
-
- public function hasAmbiguousRevisionRefs() {
- return (count($this->getRevisionRefs()) > 1);
- }
-
-}
diff --git a/src/toolset/query/ArcanistWorkflowHardpointQuery.php b/src/toolset/query/ArcanistWorkflowHardpointQuery.php
--- a/src/toolset/query/ArcanistWorkflowHardpointQuery.php
+++ b/src/toolset/query/ArcanistWorkflowHardpointQuery.php
@@ -38,7 +38,7 @@
return false;
}
- if (!$object instanceof ArcanistRefPro) {
+ if (!$object instanceof ArcanistRef) {
return false;
}
@@ -49,7 +49,7 @@
return true;
}
- abstract protected function canLoadRef(ArcanistRefPro $ref);
+ abstract protected function canLoadRef(ArcanistRef $ref);
final public function yieldConduit($method, array $parameters) {
$conduit_engine = $this->getWorkflow()
@@ -74,7 +74,7 @@
}
final public function yieldValue(array $refs, $value) {
- assert_instances_of($refs, 'ArcanistRefPro');
+ assert_instances_of($refs, 'ArcanistRef');
$keys = array_keys($refs);
$map = array_fill_keys($keys, $value);
diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php
--- a/src/workflow/ArcanistDiffWorkflow.php
+++ b/src/workflow/ArcanistDiffWorkflow.php
@@ -3051,18 +3051,23 @@
}
private function getDependsOnRevisionRef() {
+ // TODO: Restore this behavior after updating for toolsets. Loading the
+ // required hardpoints currently depends on a "WorkingCopy" existing.
+ return null;
+
$api = $this->getRepositoryAPI();
$base_ref = $api->getBaseCommitRef();
- $state_ref = $this->newWorkingCopyStateRef()
+ $state_ref = id(new ArcanistWorkingCopyStateRef())
->setCommitRef($base_ref);
- $this->newRefQuery(array($state_ref))
- ->needHardpoints(
- array(
- 'revisionRefs',
- ))
- ->execute();
+ $this->loadHardpoints(
+ array(
+ $state_ref,
+ ),
+ array(
+ ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
+ ));
$revision_refs = $state_ref->getRevisionRefs();
$viewer_phid = $this->getUserPHID();
diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php
--- a/src/workflow/ArcanistFeatureWorkflow.php
+++ b/src/workflow/ArcanistFeatureWorkflow.php
@@ -71,17 +71,22 @@
}
$states = array();
- foreach ($branches as $branch) {
- $states[] = $this->newWorkingCopyStateRef()
- ->attachBranchRef($branch);
+ foreach ($branches as $branch_key => $branch) {
+ $state_ref = id(new ArcanistWorkingCopyStateRef())
+ ->setCommitRef($branch->getCommitRef());
+
+ $states[] = array(
+ 'branch' => $branch,
+ 'state' => $state_ref,
+ );
}
- $this->newRefQuery($states)
- ->needHardpoints(
- array(
- 'revisionRefs',
- ))
- ->execute();
+ $this->loadHardpoints(
+ ipull($states, 'state'),
+ array(
+ ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
+ ));
+
$this->printBranches($states);
@@ -177,8 +182,9 @@
);
$out = array();
- foreach ($states as $state) {
- $branch = $state->getBranchRef();
+ foreach ($states as $objects) {
+ $state = $objects['state'];
+ $branch = $objects['branch'];
$revision = null;
if ($state->hasAmbiguousRevisionRefs()) {
diff --git a/src/workflow/ArcanistInspectWorkflow.php b/src/workflow/ArcanistInspectWorkflow.php
--- a/src/workflow/ArcanistInspectWorkflow.php
+++ b/src/workflow/ArcanistInspectWorkflow.php
@@ -117,7 +117,7 @@
return 0;
}
- private function describeRef(ArcanistRefPro $ref, $depth) {
+ private function describeRef(ArcanistRef $ref, $depth) {
$indent = str_repeat(' ', $depth);
$out = array();
@@ -139,7 +139,7 @@
}
private function describeHardpoint(
- ArcanistRefPro $ref,
+ ArcanistRef $ref,
ArcanistHardpoint $hardpoint,
$depth) {
$indent = str_repeat(' ', $depth);
@@ -152,11 +152,11 @@
$mode = '*';
$value = $ref->getHardpoint($hardpoint_key);
- if ($value instanceof ArcanistRefPro) {
+ if ($value instanceof ArcanistRef) {
$children[] = $value;
} else if (is_array($value)) {
foreach ($value as $key => $child) {
- if ($child instanceof ArcanistRefPro) {
+ if ($child instanceof ArcanistRef) {
$children[] = $child;
} else {
$values[] = $value;
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -2250,15 +2250,6 @@
return $this->conduitEngine;
}
- final protected function newWorkingCopyStateRef() {
- $ref = new ArcanistWorkingCopyStateRef();
-
- $working_copy = $this->getWorkingCopyIdentity();
- $ref->setRootDirectory($working_copy->getProjectRoot());
-
- return $ref;
- }
-
final protected function newRefQuery(array $refs) {
assert_instances_of($refs, 'ArcanistRef');

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 2:35 AM (1 w, 2 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/dv/ei/44aajeyurki2qrrw
Default Alt Text
D21082.id50222.diff (48 KB)

Event Timeline