Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14844651
D21374.id50876.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D21374.id50876.diff
View Options
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',
@@ -1447,6 +1448,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 @@
+<?php
+
+final class ArcanistRemoteRefInspector
+ extends ArcanistRefInspector {
+
+ public function getInspectFunctionName() {
+ return 'remote';
+ }
+
+ public function newInspectRef(array $argv) {
+ if (count($argv) !== 1) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Expected exactly one argument to "remote(...)" with a '.
+ 'remote name.'));
+ }
+
+ $remote_name = $argv[0];
+
+ $workflow = $this->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",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 3, 5:28 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7087431
Default Alt Text
D21374.id50876.diff (3 KB)
Attached To
Mode
D21374: Support inspection of remote refs with "arc inspect remote(...)"
Attached
Detach File
Event Timeline
Log In to Comment