Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15391322
D12898.id31022.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Referenced Files
None
Subscribers
None
D12898.id31022.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
@@ -3150,7 +3150,6 @@
'ReleephProductTransactionQuery' => 'applications/releeph/query/ReleephProductTransactionQuery.php',
'ReleephProductViewController' => 'applications/releeph/controller/product/ReleephProductViewController.php',
'ReleephProject' => 'applications/releeph/storage/ReleephProject.php',
- 'ReleephProjectInfoConduitAPIMethod' => 'applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php',
'ReleephQueryBranchesConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryBranchesConduitAPIMethod.php',
'ReleephQueryProductsConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryProductsConduitAPIMethod.php',
'ReleephQueryRequestsConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php',
@@ -6731,7 +6730,6 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
- 'ReleephProjectInfoConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryBranchesConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryProductsConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryRequestsConduitAPIMethod' => 'ReleephConduitAPIMethod',
diff --git a/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-final class ReleephProjectInfoConduitAPIMethod extends ReleephConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'releeph.projectinfo';
- }
-
- public function getMethodDescription() {
- return
- 'Fetch information about all Releeph projects '.
- 'for a given Arcanist project.';
- }
-
- protected function defineParamTypes() {
- return array(
- 'arcProjectName' => 'optional string',
- );
- }
-
- protected function defineReturnType() {
- return 'dict<string, wild>';
- }
-
- protected function defineErrorTypes() {
- return array(
- 'ERR_UNKNOWN_ARC' =>
- "The given Arcanist project name doesn't exist in the ".
- "installation of Phabricator you are accessing.",
- );
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $arc_project_name = $request->getValue('arcProjectName');
- if ($arc_project_name) {
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->loadOneWhere('name = %s', $arc_project_name);
- if (!$arc_project) {
- throw id(new ConduitException('ERR_UNKNOWN_ARC'))
- ->setErrorDescription(
- "Unknown Arcanist project '{$arc_project_name}': ".
- "are you using the correct Conduit URI?");
- }
-
- $releeph_projects = id(new ReleephProject())
- ->loadAllWhere('arcanistProjectID = %d', $arc_project->getID());
- } else {
- $releeph_projects = id(new ReleephProject())->loadAll();
- }
-
- $releeph_projects = mfilter($releeph_projects, 'getIsActive');
-
- $result = array();
- foreach ($releeph_projects as $releeph_project) {
- $selector = $releeph_project->getReleephFieldSelector();
- $fields = $selector->getFieldSpecifications();
-
- $fields_info = array();
- foreach ($fields as $field) {
- $field->setReleephProject($releeph_project);
- if ($field->isEditable()) {
- $key = $field->getKeyForConduit();
- $fields_info[$key] = array(
- 'class' => get_class($field),
- 'name' => $field->getName(),
- 'key' => $key,
- 'arcHelp' => $field->renderHelpForArcanist(),
- );
- }
- }
-
- $releeph_branches = mfilter(
- id(new ReleephBranch())
- ->loadAllWhere('releephProjectID = %d', $releeph_project->getID()),
- 'getIsActive');
-
- $releeph_branches_struct = array();
- foreach ($releeph_branches as $branch) {
- $releeph_branches_struct[] = array(
- 'branchName' => $branch->getName(),
- 'projectName' => $releeph_project->getName(),
- 'projectPHID' => $releeph_project->getPHID(),
- 'branchPHID' => $branch->getPHID(),
- );
- }
-
- $result[] = array(
- 'projectName' => $releeph_project->getName(),
- 'projectPHID' => $releeph_project->getPHID(),
- 'branches' => $releeph_branches_struct,
- 'fields' => $fields_info,
- );
- }
-
- return $result;
- }
-
-}
diff --git a/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php b/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
--- a/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
@@ -13,10 +13,10 @@
$template = ReleephBranchTemplate::getDefaultTemplate();
}
- $arc_project_id = $request->getInt('arcProjectID');
+ $repository_phid = $request->getInt('repositoryPHID');
$fake_commit_handle =
ReleephBranchTemplate::getFakeCommitHandleFor(
- $arc_project_id,
+ $repository_phid,
$request->getUser());
list($name, $errors) = id(new ReleephBranchTemplate())
diff --git a/src/applications/releeph/controller/product/ReleephProductCreateController.php b/src/applications/releeph/controller/product/ReleephProductCreateController.php
--- a/src/applications/releeph/controller/product/ReleephProductCreateController.php
+++ b/src/applications/releeph/controller/product/ReleephProductCreateController.php
@@ -6,9 +6,8 @@
$request = $this->getRequest();
$name = trim($request->getStr('name'));
$trunk_branch = trim($request->getStr('trunkBranch'));
- $arc_pr_id = $request->getInt('arcPrID');
+ $repository_phid = $request->getInt('repositoryPHID');
- $arc_projects = $this->loadArcProjects();
$e_name = true;
$e_trunk_branch = true;
@@ -27,14 +26,10 @@
'You must specify which branch you will be picking from.');
}
- $arc_project = $arc_projects[$arc_pr_id];
- $pr_repository = null;
- if ($arc_project->getRepositoryID()) {
- $pr_repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($request->getUser())
- ->withIDs(array($arc_project->getRepositoryID()))
- ->executeOne();
- }
+ $pr_repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($request->getUser())
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
if (!$errors) {
@@ -42,7 +37,6 @@
->setName($name)
->setTrunkBranch($trunk_branch)
->setRepositoryPHID($pr_repository->getPHID())
- ->setArcanistProjectID($arc_project->getID())
->setCreatedByUserPHID($request->getUser()->getPHID())
->setIsActive(1);
@@ -58,8 +52,6 @@
}
}
- $arc_project_options = $this->getArcProjectSelectOptions($arc_projects);
-
$product_name_input = id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setDisableAutocomplete(true)
@@ -68,32 +60,15 @@
->setError($e_name)
->setCaption(pht('A name like "Thrift" but not "Thrift releases".'));
- $arc_project_input = id(new AphrontFormSelectControl())
- ->setLabel(pht('Arc Project'))
- ->setName('arcPrID')
- ->setValue($arc_pr_id)
- ->setCaption(pht(
- 'If your Arc project isn\'t listed, associate it with a repository %s',
- phutil_tag(
- 'a',
- array(
- 'href' => '/repository/',
- 'target' => '_blank',
- ),
- 'here')))
- ->setOptions($arc_project_options);
-
$branch_name_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Example Branch'))
->addControl('projectName', $product_name_input)
- ->addControl('arcProjectID', $arc_project_input)
->addStatic('template', '')
->addStatic('isSymbolic', false);
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild($product_name_input)
- ->appendChild($arc_project_input)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Trunk'))
@@ -126,44 +101,4 @@
));
}
- private function loadArcProjects() {
- $viewer = $this->getRequest()->getUser();
-
- $projects = id(new PhabricatorRepositoryArcanistProjectQuery())
- ->setViewer($viewer)
- ->needRepositories(true)
- ->execute();
-
- $projects = mfilter($projects, 'getRepository');
- $projects = msort($projects, 'getName');
-
- return $projects;
- }
-
- private function getArcProjectSelectOptions(array $arc_projects) {
- assert_instances_of($arc_projects, 'PhabricatorRepositoryArcanistProject');
-
- $repos = mpull($arc_projects, 'getRepository');
- $repos = mpull($repos, null, 'getID');
-
- $groups = array();
- foreach ($arc_projects as $arc_project) {
- $id = $arc_project->getID();
- $repo_id = $arc_project->getRepository()->getID();
- $groups[$repo_id][$id] = $arc_project->getName();
- }
-
- $choices = array();
- foreach ($groups as $repo_id => $group) {
- $repo_name = $repos[$repo_id]->getName();
- $callsign = $repos[$repo_id]->getCallsign();
- $name = "r{$callsign} ({$repo_name})";
- $choices[$name] = $group;
- }
-
- ksort($choices);
-
- return $choices;
- }
-
}
diff --git a/src/applications/releeph/controller/product/ReleephProductEditController.php b/src/applications/releeph/controller/product/ReleephProductEditController.php
--- a/src/applications/releeph/controller/product/ReleephProductEditController.php
+++ b/src/applications/releeph/controller/product/ReleephProductEditController.php
@@ -15,7 +15,6 @@
$product = id(new ReleephProductQuery())
->setViewer($viewer)
->withIDs(array($this->productID))
- ->needArcanistProjects(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@@ -48,7 +47,7 @@
$test_paths = $product->getDetail('testPaths', array());
}
- $arc_project_id = $product->getArcanistProjectID();
+ $repository_phid = $product->getRepositoryPHID();
if ($request->isFormPost()) {
$pusher_phids = $request->getArr('pushers');
@@ -93,7 +92,7 @@
->setDetail('testPaths', $test_paths);
$fake_commit_handle =
- ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id, $viewer);
+ ReleephBranchTemplate::getFakeCommitHandleFor($repository_phid, $viewer);
if ($branch_template) {
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
@@ -136,11 +135,6 @@
$product->getRepository()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel(pht('Arc Project'))
- ->setValue(
- $product->getArcanistProject()->getName()))
- ->appendChild(
- id(new AphrontFormStaticControl())
->setLabel(pht('Releeph Project PHID'))
->setValue(
$product->getPHID()))
@@ -179,7 +173,6 @@
$branch_template_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Preview'))
->addControl('template', $branch_template_input)
- ->addStatic('arcProjectID', $arc_project_id)
->addStatic('isSymbolic', false)
->addStatic('projectName', $product->getName());
diff --git a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
--- a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
@@ -25,18 +25,18 @@
}
$this->revision = $diff_rev;
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->loadOneWhere('phid = %s', $this->revision->getArcanistProjectPHID());
+ $repository = $this->revision->getRepository();
$projects = id(new ReleephProject())->loadAllWhere(
- 'arcanistProjectID = %d AND isActive = 1',
- $arc_project->getID());
+ 'repositoryPHID = %s AND isActive = 1',
+ $repository->getPHID());
if (!$projects) {
- throw new Exception(sprintf(
- "D%d belongs to the '%s' Arcanist project, ".
- "which is not part of any Releeph project!",
- $this->revision->getID(),
- $arc_project->getName()));
+ throw new Exception(
+ pht(
+ "D%d belongs to the '%s' repository, ".
+ "which is not part of any Releeph project!",
+ $this->revision->getID(),
+ $repository->getMonogram()));
}
$branches = id(new ReleephBranch())->loadAllWhere(
diff --git a/src/applications/releeph/query/ReleephProductQuery.php b/src/applications/releeph/query/ReleephProductQuery.php
--- a/src/applications/releeph/query/ReleephProductQuery.php
+++ b/src/applications/releeph/query/ReleephProductQuery.php
@@ -8,8 +8,6 @@
private $phids;
private $repositoryPHIDs;
- private $needArcanistProjects;
-
const ORDER_ID = 'order-id';
const ORDER_NAME = 'order-name';
@@ -47,11 +45,6 @@
return $this;
}
- public function needArcanistProjects($need) {
- $this->needArcanistProjects = $need;
- return $this;
- }
-
protected function loadPage() {
$table = new ReleephProject();
$conn_r = $table->establishConnection('r');
@@ -90,27 +83,6 @@
return $projects;
}
- protected function didFilterPage(array $products) {
- if ($this->needArcanistProjects) {
- $project_ids = array_filter(mpull($products, 'getArcanistProjectID'));
- if ($project_ids) {
- $projects = id(new PhabricatorRepositoryArcanistProject())
- ->loadAllWhere('id IN (%Ld)', $project_ids);
- $projects = mpull($projects, null, 'getID');
- } else {
- $projects = array();
- }
-
- foreach ($products as $product) {
- $project_id = $product->getArcanistProjectID();
- $project = idx($projects, $project_id);
- $product->attachArcanistProject($project);
- }
- }
-
- return $products;
- }
-
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
diff --git a/src/applications/releeph/query/ReleephProductSearchEngine.php b/src/applications/releeph/query/ReleephProductSearchEngine.php
--- a/src/applications/releeph/query/ReleephProductSearchEngine.php
+++ b/src/applications/releeph/query/ReleephProductSearchEngine.php
@@ -21,8 +21,7 @@
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new ReleephProductQuery())
- ->setOrder(ReleephProductQuery::ORDER_NAME)
- ->needArcanistProjects(true);
+ ->setOrder(ReleephProductQuery::ORDER_NAME);
$active = $saved->getParameter('active');
$value = idx($this->getActiveValues(), $active);
@@ -119,11 +118,6 @@
),
'r'.$repo->getCallsign()));
- $arc = $product->getArcanistProject();
- if ($arc) {
- $item->addAttribute($arc->getName());
- }
-
$list->addItem($item);
}
diff --git a/src/applications/releeph/view/branch/ReleephBranchTemplate.php b/src/applications/releeph/view/branch/ReleephBranchTemplate.php
--- a/src/applications/releeph/view/branch/ReleephBranchTemplate.php
+++ b/src/applications/releeph/view/branch/ReleephBranchTemplate.php
@@ -20,23 +20,14 @@
}
public static function getFakeCommitHandleFor(
- $arc_project_id,
+ $repository_phid,
PhabricatorUser $viewer) {
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->load($arc_project_id);
- if (!$arc_project) {
- throw new Exception(
- "No Arc project found with id '{$arc_project_id}'!");
- }
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
- $repository = null;
- if ($arc_project->getRepositoryID()) {
- $repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($viewer)
- ->withIDs(array($arc_project->getRepositoryID()))
- ->executeOne();
- }
$fake_handle = 'SOFAKE';
if ($repository) {
$fake_handle = id(new PhabricatorObjectHandle())
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 9:21 AM (5 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706734
Default Alt Text
D12898.id31022.diff (16 KB)
Attached To
Mode
D12898: Remove "arcanist projects" from Releeph
Attached
Detach File
Event Timeline
Log In to Comment