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 @@ -419,6 +419,7 @@ 'ArcanistRefInspector' => 'inspector/ArcanistRefInspector.php', 'ArcanistRefView' => 'ref/ArcanistRefView.php', 'ArcanistRemoteRef' => 'repository/remote/ArcanistRemoteRef.php', + 'ArcanistRemoteRefInspector' => 'repository/remote/ArcanistRemoteRefInspector.php', 'ArcanistRepositoryAPI' => 'repository/api/ArcanistRepositoryAPI.php', 'ArcanistRepositoryAPIMiscTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIMiscTestCase.php', 'ArcanistRepositoryAPIStateTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php', @@ -1449,6 +1450,7 @@ 'ArcanistTerminalStringInterface', ), 'ArcanistRemoteRef' => 'ArcanistRef', + 'ArcanistRemoteRefInspector' => 'ArcanistRefInspector', 'ArcanistRepositoryAPI' => 'Phobject', 'ArcanistRepositoryAPIMiscTestCase' => 'PhutilTestCase', 'ArcanistRepositoryAPIStateTestCase' => 'PhutilTestCase', diff --git a/src/inspector/ArcanistRefInspector.php b/src/inspector/ArcanistRefInspector.php --- a/src/inspector/ArcanistRefInspector.php +++ b/src/inspector/ArcanistRefInspector.php @@ -3,6 +3,17 @@ abstract class ArcanistRefInspector extends Phobject { + private $workflow; + + final public function setWorkflow(ArcanistWorkflow $workflow) { + $this->workflow = $workflow; + return $this; + } + + final public function getWorkflow() { + return $this->workflow; + } + abstract public function getInspectFunctionName(); abstract public function newInspectRef(array $argv); diff --git a/src/repository/remote/ArcanistRemoteRefInspector.php b/src/repository/remote/ArcanistRemoteRefInspector.php new file mode 100644 --- /dev/null +++ b/src/repository/remote/ArcanistRemoteRefInspector.php @@ -0,0 +1,37 @@ +getWorkflow(); + $api = $workflow->getRepositoryAPI(); + + $ref = $api->newRemoteRefQuery() + ->withNames(array($remote_name)) + ->executeOne(); + + if (!$ref) { + throw new PhutilArgumentUsageException( + pht( + 'This working copy has no remote named "%s".', + $remote_name)); + } + + return $ref; + } + +} diff --git a/src/workflow/ArcanistInspectWorkflow.php b/src/workflow/ArcanistInspectWorkflow.php --- a/src/workflow/ArcanistInspectWorkflow.php +++ b/src/workflow/ArcanistInspectWorkflow.php @@ -34,6 +34,10 @@ $inspectors = ArcanistRefInspector::getAllInspectors(); + foreach ($inspectors as $inspector) { + $inspector->setWorkflow($this); + } + if (!$objects) { echo tsprintf( "%s\n\n",