Page MenuHomePhabricator

D12971.diff
No OneTemporary

D12971.diff

diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -1527,58 +1527,14 @@
}
final protected function getRepositoryEncoding() {
- $default = 'UTF-8';
- return nonempty(idx($this->getProjectInfo(), 'encoding'), $default);
- }
-
- final protected function getProjectInfo() {
- if ($this->projectInfo === null) {
- $project_id = $this->getWorkingCopy()->getProjectID();
- if (!$project_id) {
- $this->projectInfo = array();
- } else {
- try {
- $this->projectInfo = $this->getConduit()->callMethodSynchronous(
- 'arcanist.projectinfo',
- array(
- 'name' => $project_id,
- ));
- } catch (ConduitClientException $ex) {
- if ($ex->getErrorCode() != 'ERR-BAD-ARCANIST-PROJECT') {
- throw $ex;
- }
-
- // TODO: Implement a proper query method that doesn't throw on
- // project not found. We just swallow this because some pathways,
- // like Git with uncommitted changes in a repository with a new
- // project ID, may attempt to access project information before
- // the project is created. See T2153.
- return array();
- }
- }
- }
-
- return $this->projectInfo;
+ return nonempty(
+ idx($this->loadProjectRepository(), 'encoding'),
+ 'UTF-8');
}
final protected function loadProjectRepository() {
- $project = $this->getProjectInfo();
- if (isset($project['repository'])) {
- return $project['repository'];
- }
- // NOTE: The rest of the code is here for backwards compatibility.
-
- $repository_phid = idx($project, 'repositoryPHID');
- if (!$repository_phid) {
- return array();
- }
-
- $repositories = $this->getConduit()->callMethodSynchronous(
- 'repository.query',
- array());
- $repositories = ipull($repositories, null, 'phid');
-
- return idx($repositories, $repository_phid, array());
+ list($info, $reasons) = $this->loadRepositoryInformation();
+ return $info;
}
final protected function newInteractiveEditor($text) {
@@ -1812,40 +1768,6 @@
'repository.callsign');
}
- $project_info = $this->getProjectInfo();
- $project_name = $this->getWorkingCopy()->getProjectID();
- if ($this->getProjectInfo()) {
- if (!empty($project_info['repository']['callsign'])) {
- $callsign = $project_info['repository']['callsign'];
- $query = array(
- 'callsigns' => array($callsign),
- );
- $reasons[] = pht(
- 'Configuration value "%s" is set to "%s"; this project '.
- 'is associated with the "%s" repository.',
- 'project.name',
- $project_name,
- $callsign);
- return array($query, $reasons);
- } else {
- $reasons[] = pht(
- 'Configuration value "%s" is set to "%s", but this '.
- 'project is not associated with a repository.',
- 'project.name',
- $project_name);
- }
- } else if (strlen($project_name)) {
- $reasons[] = pht(
- 'Configuration value "%s" is set to "%s", but that '.
- 'project does not exist.',
- 'project.name',
- $project_name);
- } else {
- $reasons[] = pht(
- 'Configuration value "%s" is empty.',
- 'project.name');
- }
-
$uuid = $this->getRepositoryAPI()->getRepositoryUUID();
if ($uuid !== null) {
$query = array(

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 1:05 AM (2 d, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714107
Default Alt Text
D12971.diff (3 KB)

Event Timeline