Page MenuHomePhabricator

D21099.diff
No OneTemporary

D21099.diff

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
@@ -233,7 +233,24 @@
}
$ref_uri = head($ref_uris);
- $uris[] = $ref_uri->getURI();
+
+ // TODO: "ArcanistRevisionRef", at least, may return a relative URI.
+ // If we get a relative URI, guess the correct absolute URI based on
+ // the Conduit URI. This might not be correct for Conduit over SSH.
+
+ $raw_uri = $ref_uri->getURI();
+
+ $raw_uri = new PhutilURI($raw_uri);
+ if (!strlen($raw_uri->getDomain())) {
+ $base_uri = $this->getConduitEngine()
+ ->getConduitURI();
+
+ $raw_uri = id(new PhutilURI($base_uri))
+ ->setPath($raw_uri->getPath());
+ }
+ $raw_uri = phutil_string_cast($raw_uri);
+
+ $uris[] = $raw_uri;
}
$this->openURIsInBrowser($uris);
diff --git a/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php b/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
--- a/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
+++ b/src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
@@ -60,7 +60,7 @@
continue;
}
- $revision_ref = ArcanistRevisionRef::newFromConduit($dict);
+ $revision_ref = ArcanistRevisionRef::newFromConduitQuery($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
@@ -53,8 +53,8 @@
$results = array();
if ($map) {
- $revisions = (yield $this->yieldConduit(
- 'differential.query',
+ $revisions = (yield $this->yieldConduitSearch(
+ 'differential.revision.search',
array(
'ids' => array_keys($map),
)));
diff --git a/src/ref/revision/ArcanistRevisionRef.php b/src/ref/revision/ArcanistRevisionRef.php
--- a/src/ref/revision/ArcanistRevisionRef.php
+++ b/src/ref/revision/ArcanistRevisionRef.php
@@ -26,28 +26,59 @@
return $ref;
}
+ public static function newFromConduitQuery(array $dict) {
+ // Mangle an older "differential.query" result to look like a modern
+ // "differential.revision.search" result.
+
+ $status_name = idx($dict, 'statusName');
+
+ switch ($status_name) {
+ case 'Abandoned':
+ case 'Closed':
+ $is_closed = true;
+ break;
+ default:
+ $is_closed = false;
+ break;
+ }
+
+ $dict['fields'] = array(
+ 'uri' => idx($dict, 'uri'),
+ 'title' => idx($dict, 'title'),
+ 'authorPHID' => idx($dict, 'authorPHID'),
+ 'status' => array(
+ 'name' => $status_name,
+ 'closed' => $is_closed,
+ ),
+ );
+
+ return self::newFromConduit($dict);
+ }
+
public function getMonogram() {
return 'D'.$this->getID();
}
public function getStatusDisplayName() {
- return idx($this->parameters, 'statusName');
+ return idxv($this->parameters, array('fields', 'status', 'name'));
}
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;
+ return idxv($this->parameters, array('fields', 'status', 'closed'));
}
public function getURI() {
- return idx($this->parameters, 'uri');
+ $uri = idxv($this->parameters, array('fields', 'uri'));
+
+ if ($uri === null) {
+ // TODO: The "uri" field was added at the same time as this callsite,
+ // so we may not have it yet if the server is running an older version
+ // of Phabricator. Fake our way through.
+
+ $uri = '/'.$this->getMonogram();
+ }
+
+ return $uri;
}
public function getFullName() {
@@ -63,11 +94,11 @@
}
public function getName() {
- return idx($this->parameters, 'title');
+ return idxv($this->parameters, array('fields', 'title'));
}
public function getAuthorPHID() {
- return idx($this->parameters, 'authorPHID');
+ return idxv($this->parameters, array('fields', 'authorPHID'));
}
public function addSource(ArcanistRevisionRefSource $source) {
diff --git a/src/ref/revision/ArcanistRevisionSymbolHardpointQuery.php b/src/ref/revision/ArcanistRevisionSymbolHardpointQuery.php
--- a/src/ref/revision/ArcanistRevisionSymbolHardpointQuery.php
+++ b/src/ref/revision/ArcanistRevisionSymbolHardpointQuery.php
@@ -17,10 +17,10 @@
$id_map = mpull($refs, 'getSymbol');
$id_set = array_fuse($id_map);
- $revisions = (yield $this->yieldConduit(
- 'differential.query',
+ $revisions = (yield $this->yieldConduitSearch(
+ 'differential.revision.search',
array(
- 'ids' => $id_set,
+ 'ids' => array_values($id_set),
)));
$refs = array();
diff --git a/src/workflow/ArcanistLiberateWorkflow.php b/src/workflow/ArcanistLiberateWorkflow.php
--- a/src/workflow/ArcanistLiberateWorkflow.php
+++ b/src/workflow/ArcanistLiberateWorkflow.php
@@ -33,6 +33,16 @@
);
}
+ protected function newPrompts() {
+ return array(
+ $this->newPrompt('arc.liberate.create')
+ ->setDescription(
+ pht(
+ 'Confirms creation of a new library.')),
+ );
+ }
+
+
public function runWorkflow() {
$log = $this->getLogEngine();
@@ -154,10 +164,18 @@
return;
}
- echo pht("The directory '%s' does not exist.", $path);
- if (!phutil_console_confirm(pht('Do you want to create it?'))) {
- throw new ArcanistUsageException(pht('Cancelled.'));
- }
+ echo tsprintf(
+ "%!\n%W\n",
+ pht('NEW LIBRARY'),
+ pht(
+ 'The directory "%s" does not exist. Do you want to create it?',
+ $path));
+
+ $query = pht('Create new library?');
+
+ $this->getPrompt('arc.liberate.create')
+ ->setQuery($query)
+ ->execute();
execx('mkdir -p %R', $path);
}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -2140,7 +2140,7 @@
'Failed to open URI "%s" in browser ("%s"). '.
'Check your "browser" config option.',
$uri,
- $browser));
+ implode(' ', $browser)));
}
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 2:28 AM (18 h, 39 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6922714
Default Alt Text
D21099.diff (6 KB)

Event Timeline