Page MenuHomePhabricator

D12898.id31373.diff
No OneTemporary

D12898.id31373.diff

diff --git a/resources/sql/patches/20150521.releephrepository.sql b/resources/sql/patches/20150521.releephrepository.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20150521.releephrepository.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_releeph.releeph_project
+ MODIFY arcanistProjectID int(10) unsigned NULL;
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
@@ -3151,7 +3151,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',
@@ -6734,7 +6733,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,100 +0,0 @@
-<?php
-
-final class ReleephProjectInfoConduitAPIMethod extends ReleephConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'releeph.projectinfo';
- }
-
- public function getMethodDescription() {
- return pht(
- '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' => pht(
- "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(
- pht(
- "Unknown Arcanist project '%s': ".
- "are you using the correct Conduit URI?",
- $arc_project_name));
- }
-
- $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,7 @@
$request = $this->getRequest();
$name = trim($request->getStr('name'));
$trunk_branch = trim($request->getStr('trunkBranch'));
- $arc_pr_id = $request->getInt('arcPrID');
-
- $arc_projects = $this->loadArcProjects();
+ $repository_phid = $request->getStr('repositoryPHID');
$e_name = true;
$e_trunk_branch = true;
@@ -27,14 +25,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 +36,6 @@
->setName($name)
->setTrunkBranch($trunk_branch)
->setRepositoryPHID($pr_repository->getPHID())
- ->setArcanistProjectID($arc_project->getID())
->setCreatedByUserPHID($request->getUser()->getPHID())
->setIsActive(1);
@@ -58,7 +51,7 @@
}
}
- $arc_project_options = $this->getArcProjectSelectOptions($arc_projects);
+ $repo_options = $this->getRepositorySelectOptions();
$product_name_input = id(new AphrontFormTextControl())
->setLabel(pht('Name'))
@@ -68,32 +61,23 @@
->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);
+ $repository_input = id(new AphrontFormSelectControl())
+ ->setLabel(pht('Repository'))
+ ->setName('repositoryPHID')
+ ->setValue($repository_phid)
+ ->setOptions($repo_options);
$branch_name_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Example Branch'))
->addControl('projectName', $product_name_input)
- ->addControl('arcProjectID', $arc_project_input)
+ ->addControl('repositoryPHID', $repository_input)
->addStatic('template', '')
->addStatic('isSymbolic', false);
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild($product_name_input)
- ->appendChild($arc_project_input)
+ ->appendChild($repository_input)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Trunk'))
@@ -126,43 +110,23 @@
));
}
- private function loadArcProjects() {
- $viewer = $this->getRequest()->getUser();
-
- $projects = id(new PhabricatorRepositoryArcanistProjectQuery())
- ->setViewer($viewer)
- ->needRepositories(true)
+ private function getRepositorySelectOptions() {
+ $repos = id(new PhabricatorRepositoryQuery())
+ ->setViewer($this->getRequest()->getUser())
->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 = msort($repos, 'getName');
$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;
+
+ foreach ($repos as $repo_id => $repo) {
+ $repo_name = $repo->getName();
+ $callsign = $repo->getCallsign();
+ $choices[$repo->getPHID()] = "r{$callsign} ({$repo_name})";
}
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');
@@ -92,8 +91,9 @@
->setDetail('branchTemplate', $branch_template)
->setDetail('testPaths', $test_paths);
- $fake_commit_handle =
- ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id, $viewer);
+ $fake_commit_handle = ReleephBranchTemplate::getFakeCommitHandleFor(
+ $repository_phid,
+ $viewer);
if ($branch_template) {
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
@@ -136,9 +136,9 @@
$product->getRepository()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel(pht('Arc Project'))
+ ->setLabel(pht('Repository'))
->setValue(
- $product->getArcanistProject()->getName()))
+ $product->getRepository()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Releeph Project PHID'))
@@ -179,7 +179,7 @@
$branch_template_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Preview'))
->addControl('template', $branch_template_input)
- ->addStatic('arcProjectID', $arc_project_id)
+ ->addStatic('repositoryPHID', $repository_phid)
->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,19 +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(
pht(
- "%s belongs to the '%s' Arcanist project, ".
+ "%s belongs to the '%s' repository, ".
"which is not part of any Releeph project!",
'D'.$this->revision->getID(),
- $arc_project->getName()));
+ $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/ReleephBranchPreviewView.php b/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
--- a/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
+++ b/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
@@ -24,7 +24,7 @@
protected function renderInput() {
static $required_params = array(
- 'arcProjectID',
+ 'repositoryPHID',
'projectName',
'isSymbolic',
'template',
@@ -43,9 +43,9 @@
$output_id = celerity_generate_unique_node_id();
Javelin::initBehavior('releeph-preview-branch', array(
- 'uri' => '/releeph/branch/preview/',
- 'outputID' => $output_id,
- 'params' => array(
+ 'uri' => '/releeph/branch/preview/',
+ 'outputID' => $output_id,
+ 'params' => array(
'static' => $this->statics,
'dynamic' => $this->dynamics,
),
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,25 +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(
- pht(
- "No Arc project found with id '%s'!",
- $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

Mime Type
text/plain
Expires
Thu, Jan 16, 9:20 PM (20 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6997455
Default Alt Text
D12898.id31373.diff (18 KB)

Event Timeline