Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/releeph/application/PhabricatorApplicationReleeph.php b/src/applications/releeph/application/PhabricatorApplicationReleeph.php
index bc25016828..27a684b156 100644
--- a/src/applications/releeph/application/PhabricatorApplicationReleeph.php
+++ b/src/applications/releeph/application/PhabricatorApplicationReleeph.php
@@ -1,85 +1,85 @@
<?php
final class PhabricatorApplicationReleeph extends PhabricatorApplication {
public function getName() {
- return 'Releeph';
+ return pht('Releeph');
}
public function getShortDescription() {
- return 'Release Branches';
+ return pht('Release Branches');
}
public function getBaseURI() {
return '/releeph/';
}
public function getAutospriteName() {
return 'releeph';
}
public function getApplicationGroup() {
return self::GROUP_ORGANIZATION;
}
public function isInstalled() {
if (PhabricatorEnv::getEnvConfig('releeph.installed')) {
return parent::isInstalled();
}
return false;
}
public function getRoutes() {
return array(
'/RQ(?P<requestID>[1-9]\d*)' => 'ReleephRequestViewController',
'/releeph/' => array(
'' => 'ReleephProjectListController',
'project/' => array(
'(?:(?P<filter>active|inactive)/)?' => 'ReleephProjectListController',
'create/' => 'ReleephProjectCreateController',
'(?P<projectID>[1-9]\d*)/' => array(
'' => 'ReleephProjectViewController',
'closedbranches/' => 'ReleephProjectViewController',
'edit/' => 'ReleephProjectEditController',
'cutbranch/' => 'ReleephBranchCreateController',
'action/(?P<action>.+)/' => 'ReleephProjectActionController',
),
),
'branch/' => array(
'edit/(?P<branchID>[1-9]\d*)/' =>
'ReleephBranchEditController',
'(?P<action>close|re-open)/(?P<branchID>[1-9]\d*)/' =>
'ReleephBranchAccessController',
'preview/' => 'ReleephBranchNamePreviewController',
// Left in, just in case the by-name stuff fails!
'(?P<branchID>[^/]+)/' =>
'ReleephBranchViewController',
),
'request/' => array(
'(?P<requestID>[1-9]\d*)/' => 'ReleephRequestViewController',
'create/' => 'ReleephRequestCreateController',
'differentialcreate/' => array(
'D(?P<diffRevID>[1-9]\d*)' =>
'ReleephRequestDifferentialCreateController',
),
'edit/(?P<requestID>[1-9]\d*)/' =>
'ReleephRequestEditController',
'action/(?P<action>.+)/(?P<requestID>[1-9]\d*)/' =>
'ReleephRequestActionController',
'typeahead/' =>
'ReleephRequestTypeaheadController',
),
// Branch navigation made pretty, as it's the most common:
'(?P<projectName>[^/]+)/(?P<branchName>[^/]+)/' => array(
'' => 'ReleephBranchViewController',
'edit/' => 'ReleephBranchEditController',
'request/' => 'ReleephRequestCreateController',
'(?P<action>close|re-open)/' => 'ReleephBranchAccessController',
),
)
);
}
}
diff --git a/src/applications/releeph/controller/ReleephController.php b/src/applications/releeph/controller/ReleephController.php
index 22a8214532..2cddd83def 100644
--- a/src/applications/releeph/controller/ReleephController.php
+++ b/src/applications/releeph/controller/ReleephController.php
@@ -1,122 +1,122 @@
<?php
abstract class ReleephController extends PhabricatorController {
private $releephProject;
private $releephBranch;
private $releephRequest;
/**
* ReleephController will take care of loading any Releeph* objects
* referenced in the URL.
*/
public function willProcessRequest(array $data) {
// Project
$project = null;
$project_id = idx($data, 'projectID');
$project_name = idx($data, 'projectName');
if ($project_id) {
$project = id(new ReleephProject())->load($project_id);
if (!$project) {
throw new Exception(
"ReleephProject with id '{$project_id}' not found!");
}
} elseif ($project_name) {
$project = id(new ReleephProject())
->loadOneWhere('name = %s', $project_name);
if (!$project) {
throw new Exception(
"ReleephProject with name '{$project_name}' not found!");
}
}
// Branch
$branch = null;
$branch_id = idx($data, 'branchID');
$branch_name = idx($data, 'branchName');
if ($branch_id) {
$branch = id(new ReleephBranch())->load($branch_id);
if (!$branch) {
throw new Exception("Branch with id '{$branch_id}' not found!");
}
} elseif ($branch_name) {
if (!$project) {
throw new Exception(
"You cannot refer to a branch by name without also referring ".
"to a ReleephProject (branch names are only unique in projects).");
}
$branch = id(new ReleephBranch())->loadOneWhere(
'basename = %s AND releephProjectID = %d',
$branch_name,
$project->getID());
if (!$branch) {
throw new Exception(
"ReleephBranch with basename '{$branch_name}' not found ".
"in project '{$project->getName()}'!");
}
}
// Request
$request = null;
$request_id = idx($data, 'requestID');
if ($request_id) {
$request = id(new ReleephRequest())->load($request_id);
if (!$request) {
throw new Exception(
"ReleephRequest with id '{$request_id}' not found!");
}
}
// Fill in the gaps
if ($request && !$branch) {
$branch = $request->loadReleephBranch();
}
if ($branch && !$project) {
$project = $branch->loadReleephProject();
}
// Set!
$this->releephProject = $project;
$this->releephBranch = $branch;
$this->releephRequest = $request;
}
protected function getReleephProject() {
if (!$this->releephProject) {
throw new Exception(
'This controller did not load a ReleephProject from the URL $data.');
}
return $this->releephProject;
}
protected function getReleephBranch() {
if (!$this->releephBranch) {
throw new Exception(
'This controller did not load a ReleephBranch from the URL $data.');
}
return $this->releephBranch;
}
protected function getReleephRequest() {
if (!$this->releephRequest) {
throw new Exception(
'This controller did not load a ReleephRequest from the URL $data.');
}
return $this->releephRequest;
}
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
- $page->setApplicationName('Releeph');
+ $page->setApplicationName(pht('Releeph'));
$page->setBaseURI('/releeph/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("\xD3\x82");
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
}
diff --git a/src/applications/releeph/controller/branch/ReleephBranchAccessController.php b/src/applications/releeph/controller/branch/ReleephBranchAccessController.php
index bcaf86e964..054af82d84 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchAccessController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchAccessController.php
@@ -1,61 +1,61 @@
<?php
final class ReleephBranchAccessController extends ReleephController {
private $action;
public function willProcessRequest(array $data) {
$this->action = $data['action'];
parent::willProcessRequest($data);
}
public function processRequest() {
$rph_branch = $this->getReleephBranch();
$request = $this->getRequest();
$active_uri = '/releeph/project/'.$rph_branch->getReleephProjectID().'/';
$inactive_uri = $active_uri.'inactive/';
switch ($this->action) {
case 'close':
$is_active = false;
$origin_uri = $active_uri;
break;
case 're-open':
$is_active = true;
$origin_uri = $inactive_uri;
break;
default:
throw new Exception("Unknown action '{$this->action}'!");
break;
}
if ($request->isDialogFormPost()) {
id(new ReleephBranchEditor())
->setActor($request->getUser())
->setReleephBranch($rph_branch)
->changeBranchAccess($is_active ? 1 : 0);
return id(new AphrontRedirectResponse())
->setURI($origin_uri);
}
- $button_text = ucfirst($this->action).' Branch';
- $message = hsprintf(
- '<p>Really %s the branch <i>%s</i>?</p>',
+ $button_text = pht('%s Branch', $this->action);
+ $text = pht('Really %s the branch: %s?',
$this->action,
$rph_branch->getBasename());
+ $message = phutil_tag('p', array(), $text);
$dialog = new AphrontDialogView();
$dialog
->setUser($request->getUser())
- ->setTitle('Confirm')
+ ->setTitle(pht('Confirm'))
->appendChild($message)
->addSubmitButton($button_text)
->addCancelButton($origin_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}
diff --git a/src/applications/releeph/controller/branch/ReleephBranchCreateController.php b/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
index 6031c0388a..01c9923379 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
@@ -1,105 +1,106 @@
<?php
final class ReleephBranchCreateController extends ReleephController {
public function processRequest() {
$releeph_project = $this->getReleephProject();
$request = $this->getRequest();
$cut_point = $request->getStr('cutPoint');
$symbolic_name = $request->getStr('symbolicName');
if (!$cut_point) {
$repository = $releeph_project->loadPhabricatorRepository();
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$cut_point = $releeph_project->getTrunkBranch();
break;
}
}
$e_cut = true;
$errors = array();
$branch_date_control = id(new AphrontFormDateControl())
->setUser($request->getUser())
->setName('templateDate')
- ->setLabel('Date')
- ->setCaption('The date used for filling out the branch template.')
+ ->setLabel(pht('Date'))
+ ->setCaption(pht('The date used for filling out the branch template.'))
->setInitialTime(AphrontFormDateControl::TIME_START_OF_DAY);
$branch_date = $branch_date_control->readValueFromRequest($request);
if ($request->isFormPost()) {
$cut_commit = null;
if (!$cut_point) {
- $e_cut = 'Required';
- $errors[] = 'You must give a branch cut point';
+ $e_cut = pht('Required');
+ $errors[] = pht('You must give a branch cut point');
} else {
try {
$finder = id(new ReleephCommitFinder())
->setReleephProject($releeph_project);
$cut_commit = $finder->fromPartial($cut_point);
} catch (Exception $e) {
- $e_cut = 'Invalid';
+ $e_cut = pht('Invalid');
$errors[] = $e->getMessage();
}
}
if (!$errors) {
$branch = id(new ReleephBranchEditor())
->setReleephProject($releeph_project)
->setActor($request->getUser())
->newBranchFromCommit(
$cut_commit,
$branch_date,
$symbolic_name);
return id(new AphrontRedirectResponse())
->setURI($branch->getURI());
}
}
$error_view = array();
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setErrors($errors);
- $error_view->setTitle('Form Errors');
+ $error_view->setTitle(pht('Form Errors'));
}
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Symbolic name')
+ ->setLabel(pht('Symbolic Name'))
->setName('symbolicName')
->setValue($symbolic_name)
- ->setCaption('Mutable alternate name, for easy reference, '.
- '(e.g. "LATEST")'))
+ ->setCaption(pht('Mutable alternate name, for easy reference, '.
+ '(e.g. "LATEST")')))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Cut point')
+ ->setLabel(pht('Cut point'))
->setName('cutPoint')
->setValue($cut_point)
->setError($e_cut)
->setCaption(
- 'A commit ID for your repo type, or a Diffusion ID like "rE123"'))
+ pht('A commit ID for your repo type, or a '.
+ 'Diffusion ID like "rE123"')))
->appendChild($branch_date_control)
->appendChild(
id(new AphrontFormSubmitControl())
- ->setValue('Cut Branch')
+ ->setValue(pht('Cut Branch'))
->addCancelButton($releeph_project->getURI()));
$panel = id(new AphrontPanelView())
->appendChild($form)
- ->setHeader('Cut Branch')
+ ->setHeader(pht('Cut Branch'))
->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(
array($error_view, $panel),
- array('title' => 'Cut new branch'));
+ array('title' => pht('Cut new branch')));
}
}
diff --git a/src/applications/releeph/controller/branch/ReleephBranchEditController.php b/src/applications/releeph/controller/branch/ReleephBranchEditController.php
index 5501ee3e08..57cf246149 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchEditController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchEditController.php
@@ -1,136 +1,137 @@
<?php
final class ReleephBranchEditController extends ReleephController {
public function processRequest() {
$request = $this->getRequest();
$releeph_branch = $this->getReleephBranch();
$branch_name = $request->getStr(
'branchName',
$releeph_branch->getName());
$symbolic_name = $request->getStr(
'symbolicName',
$releeph_branch->getSymbolicName());
$e_existing_with_same_branch_name = false;
$errors = array();
if ($request->isFormPost()) {
$existing_with_same_branch_name =
id(new ReleephBranch())
->loadOneWhere(
'id != %d AND releephProjectID = %d AND name = %s',
$releeph_branch->getID(),
$releeph_branch->getReleephProjectID(),
$branch_name);
if ($existing_with_same_branch_name) {
- $errors[] = sprintf(
+ $errors[] = pht(
"The branch name %s is currently taken. Please use another name. ",
$branch_name);
- $e_existing_with_same_branch_name = 'Error';
+ $e_existing_with_same_branch_name = pht('Error');
}
if (!$errors) {
$existing_with_same_symbolic_name =
id(new ReleephBranch())
->loadOneWhere(
'id != %d AND releephProjectID = %d AND symbolicName = %s',
$releeph_branch->getID(),
$releeph_branch->getReleephProjectID(),
$symbolic_name);
$releeph_branch->openTransaction();
$releeph_branch
->setName($branch_name)
->setBasename(last(explode('/', $branch_name)))
->setSymbolicName($symbolic_name);
if ($existing_with_same_symbolic_name) {
$existing_with_same_symbolic_name
->setSymbolicName(null)
->save();
}
$releeph_branch->save();
$releeph_branch->saveTransaction();
return id(new AphrontRedirectResponse())
->setURI('/releeph/project/'.$releeph_branch->getReleephProjectID());
}
}
$phids = array();
$phids[] = $creator_phid = $releeph_branch->getCreatedByUserPHID();
$phids[] = $cut_commit_phid = $releeph_branch->getCutPointCommitPHID();
$handles = id(new PhabricatorObjectHandleData($phids))
->setViewer($request->getUser())
->loadHandles();
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel('Branch name')
+ ->setLabel(pht('Branch Name'))
->setValue($branch_name))
->appendChild(
id(new AphrontFormMarkupControl())
- ->setLabel('Cut point')
+ ->setLabel(pht('Cut Point'))
->setValue($handles[$cut_commit_phid]->renderLink()))
->appendChild(
id(new AphrontFormMarkupControl())
- ->setLabel('Created by')
+ ->setLabel(pht('Created By'))
->setValue($handles[$creator_phid]->renderLink()))
->appendChild(
id(new AphrontFormTextControl)
- ->setLabel('Symbolic Name')
+ ->setLabel(pht('Symbolic Name'))
->setName('symbolicName')
->setValue($symbolic_name)
- ->setCaption('Mutable alternate name, for easy reference, '.
- '(e.g. "LATEST")'))
- ->appendChild(hsprintf(
- '<br>' .
- 'In dire situations where the branch name is wrong, ' .
- 'you can edit it in the database by changing the field below. ' .
- 'If you do this, it is very important that you change your ' .
- 'branch\'s name in the VCS to reflect the new name in Releeph, ' .
- 'otherwise a catastrophe of previously unheard-of magnitude ' .
- 'will befall your project.'))
+ ->setCaption(pht('Mutable alternate name, for easy reference, '.
+ '(e.g. "LATEST")')))
+ ->appendChild(phutil_tag(
+ 'p',
+ array(),
+ pht('In dire situations where the branch name is wrong, ' .
+ 'you can edit it in the database by changing the field below. ' .
+ 'If you do this, it is very important that you change your ' .
+ 'branch\'s name in the VCS to reflect the new name in Releeph, ' .
+ 'otherwise a catastrophe of previously unheard-of magnitude ' .
+ 'will befall your project.')))
->appendChild(
id(new AphrontFormTextControl)
- ->setLabel('New branch name')
+ ->setLabel(pht('New Branch Name'))
->setName('branchName')
->setValue($branch_name)
->setError($e_existing_with_same_branch_name))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($releeph_branch->getURI())
- ->setValue('Save'));
+ ->setValue(pht('Save')));
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_ERROR)
->setErrors($errors)
- ->setTitle('Errors');
+ ->setTitle(pht('Errors'));
}
- $title = hsprintf(
- 'Edit branch %s',
+ $title = pht(
+ 'Edit Branch %s',
$releeph_branch->getDisplayNameWithDetail());
$panel = id(new AphrontPanelView())
->setHeader($title)
->appendChild($form)
->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(
array(
$error_view,
$panel,
),
array('title' => $title));
}
}
diff --git a/src/applications/releeph/controller/branch/ReleephBranchViewController.php b/src/applications/releeph/controller/branch/ReleephBranchViewController.php
index f01f149874..455f72d40d 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchViewController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchViewController.php
@@ -1,94 +1,94 @@
<?php
final class ReleephBranchViewController extends ReleephController {
public function processRequest() {
$request = $this->getRequest();
$releeph_branch = $this->getReleephBranch();
$releeph_project = $this->getReleephProject();
$all_releeph_requests = $releeph_branch->loadReleephRequests(
$request->getUser());
$selector = $releeph_project->getReleephFieldSelector();
$fields = $selector->arrangeFieldsForSelectForm(
$selector->getFieldSpecifications());
$form = id(new AphrontFormView())
->setMethod('GET')
->setUser($request->getUser());
$filtered_releeph_requests = $all_releeph_requests;
foreach ($fields as $field) {
$all_releeph_requests_without_this_field = $all_releeph_requests;
foreach ($fields as $other_field) {
if ($other_field != $field) {
$other_field->selectReleephRequestsHook(
$request,
$all_releeph_requests_without_this_field);
}
}
$field->appendSelectControlsHook(
$form,
$request,
$all_releeph_requests,
$all_releeph_requests_without_this_field);
$field->selectReleephRequestsHook(
$request,
$filtered_releeph_requests);
}
$form->appendChild(
id(new AphrontFormSubmitControl())
- ->setValue('Filter'));
+ ->setValue(pht('Filter')));
$list = id(new ReleephRequestHeaderListView())
->setOriginType('branch')
->setUser($request->getUser())
->setAphrontRequest($this->getRequest())
->setReleephProject($releeph_project)
->setReleephBranch($releeph_branch)
->setReleephRequests($filtered_releeph_requests);
$filter = id(new AphrontListFilterView())
->appendChild($form);
$crumbs = $this->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
->setName($releeph_project->getName())
->setHref($releeph_project->getURI()))
->addCrumb(
id(new PhabricatorCrumbView())
->setName($releeph_branch->getDisplayNameWithDetail())
->setHref($releeph_branch->getURI()));
// Don't show the request button for inactive (closed) branches
if ($releeph_branch->isActive()) {
$create_uri = $releeph_branch->getURI('request/');
$crumbs->addAction(
id(new PhabricatorMenuItemView())
->setHref($create_uri)
- ->setName('Request Pick')
+ ->setName(pht('Request Pick'))
->setIcon('create'));
}
return $this->buildStandardPageResponse(
array(
$crumbs,
$filter,
$list
),
array(
'title' =>
$releeph_project->getName().
' - '.
$releeph_branch->getDisplayName().
' requests'
));
}
}
diff --git a/src/applications/releeph/controller/project/ReleephProjectActionController.php b/src/applications/releeph/controller/project/ReleephProjectActionController.php
index 4e91107ea0..55aea937b8 100644
--- a/src/applications/releeph/controller/project/ReleephProjectActionController.php
+++ b/src/applications/releeph/controller/project/ReleephProjectActionController.php
@@ -1,63 +1,70 @@
<?php
final class ReleephProjectActionController extends ReleephController {
private $action;
public function willProcessRequest(array $data) {
parent::willProcessRequest($data);
$this->action = $data['action'];
}
public function processRequest() {
$request = $this->getRequest();
$action = $this->action;
$rph_project = $this->getReleephProject();
switch ($action) {
case 'deactivate':
if ($request->isDialogFormPost()) {
$rph_project->deactivate($request->getUser())->save();
return id(new AphrontRedirectResponse())->setURI('/releeph');
}
$dialog = id(new AphrontDialogView())
->setUser($request->getUser())
- ->setTitle('Really deactivate Releeph Project?')
- ->appendChild(hsprintf(
- '<p>Really deactivate the Releeph project <i>%s</i>?',
- $rph_project->getName()))
- ->appendChild(hsprintf(
- '<p style="margin-top:1em">It will still exist, but '.
- 'will be hidden from the list of active projects.</p>'))
- ->addSubmitButton('Deactivate Releeph Project')
+ ->setTitle(pht('Really deactivate Releeph Project?'))
+ ->appendChild(phutil_tag(
+ 'p',
+ array(),
+ pht('Really deactivate the Releeph project: %s?',
+ $rph_project->getName())))
+ ->appendChild(phutil_tag(
+ 'p',
+ array(),
+ pht('It will still exist, but '.
+ 'will be hidden from the list of active projects.')))
+ ->addSubmitButton(pht('Deactivate Releeph Project'))
->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog);
case 'activate':
$rph_project->setIsActive(1)->save();
return id(new AphrontRedirectResponse())->setURI('/releeph');
case 'delete':
if ($request->isDialogFormPost()) {
$rph_project->delete();
return id(new AphrontRedirectResponse())
->setURI('/releeph/project/inactive');
}
$dialog = id(new AphrontDialogView())
->setUser($request->getUser())
- ->setTitle('Really delete Releeph Project?')
- ->appendChild(hsprintf(
- '<p>Really delete the "%s" Releeph project? '.
- 'This cannot be undone!</p>',
- $rph_project->getName()))
- ->addSubmitButton('Delete Releeph Project')
+ ->setTitle(pht('Really delete Releeph Project?'))
+ ->appendChild(phutil_tag(
+ 'p',
+ array(),
+ pht('Really delete the Releeph project: %s? '.
+ 'This cannot be undone!'),
+ $rph_project->getName()))
+ ->setHeaderColor(PhabricatorActionHeaderView::HEADER_RED)
+ ->addSubmitButton(pht('Delete'))
->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}
}
diff --git a/src/applications/releeph/controller/project/ReleephProjectCreateController.php b/src/applications/releeph/controller/project/ReleephProjectCreateController.php
index 2dbfb72c55..39d2ac6e99 100644
--- a/src/applications/releeph/controller/project/ReleephProjectCreateController.php
+++ b/src/applications/releeph/controller/project/ReleephProjectCreateController.php
@@ -1,149 +1,149 @@
<?php
final class ReleephProjectCreateController extends ReleephController {
public function processRequest() {
$request = $this->getRequest();
$name = trim($request->getStr('name'));
$trunk_branch = trim($request->getStr('trunkBranch'));
$arc_pr_id = $request->getInt('arcPrID');
// Only allow arc projects with repositories. Sort and re-key by ID.
$arc_projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
$arc_projects = mpull(
msort(
mfilter($arc_projects, 'getRepositoryID'),
'getName'),
null,
'getID');
$e_name = true;
$e_trunk_branch = true;
$errors = array();
if ($request->isFormPost()) {
if (!$name) {
- $e_name = 'Required';
+ $e_name = pht('Required');
$errors[] =
- 'Your releeph project should have a simple descriptive name.';
+ pht('Your Releeph project should have a simple descriptive name.');
}
if (!$trunk_branch) {
- $e_trunk_branch = 'Required';
+ $e_trunk_branch = pht('Required');
$errors[] =
- 'You must specify which branch you will be picking from.';
+ pht('You must specify which branch you will be picking from.');
}
$all_names = mpull(id(new ReleephProject())->loadAll(), 'getName');
if (in_array($name, $all_names)) {
- $errors[] = "Releeph project name {$name} is already taken";
+ $errors[] = pht('Releeph project name %s is already taken', $name);
}
$arc_project = $arc_projects[$arc_pr_id];
$pr_repository = $arc_project->loadRepository();
if (!$errors) {
$releeph_project = id(new ReleephProject())
->setName($name)
->setTrunkBranch($trunk_branch)
->setRepositoryID($pr_repository->getID())
->setRepositoryPHID($pr_repository->getPHID())
->setArcanistProjectID($arc_project->getID())
->setCreatedByUserPHID($request->getUser()->getPHID())
->setIsActive(1)
->save();
return id(new AphrontRedirectResponse())->setURI('/releeph/');
}
}
$error_view = null;
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setErrors($errors);
- $error_view->setTitle('Form Errors');
+ $error_view->setTitle(pht('Form Errors'));
}
// Make our own optgroup select control
$arc_project_choices = array();
$pr_repositories = mpull(
msort(
array_filter(
// Some arc-projects don't have repositories
mpull($arc_projects, 'loadRepository')),
'getName'),
null,
'getID');
foreach ($pr_repositories as $pr_repo_id => $pr_repository) {
$options = array();
foreach ($arc_projects as $arc_project) {
if ($arc_project->getRepositoryID() == $pr_repo_id) {
$options[$arc_project->getID()] = $arc_project->getName();
}
}
$arc_project_choices[$pr_repository->getName()] = $options;
}
$project_name_input = id(new AphrontFormTextControl())
- ->setLabel('Name')
+ ->setLabel(pht('Name'))
->setDisableAutocomplete(true)
->setName('name')
->setValue($name)
->setError($e_name)
- ->setCaption('A name like "Thrift" but not "Thrift releases".');
+ ->setCaption(pht('A name like "Thrift" but not "Thrift releases".'));
$arc_project_input = id(new AphrontFormSelectControl())
- ->setLabel('Arc Project')
+ ->setLabel(pht('Arc Project'))
->setName('arcPrID')
->setValue($arc_pr_id)
- ->setCaption(hsprintf(
- "If your Arc project isn't listed, associate it with a repository %s",
+ ->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_choices);
$branch_name_preview = id(new ReleephBranchPreviewView())
- ->setLabel('Example Branch')
+ ->setLabel(pht('Example Branch'))
->addControl('projectName', $project_name_input)
->addControl('arcProjectID', $arc_project_input)
->addStatic('template', '')
->addStatic('isSymbolic', false);
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild($project_name_input)
->appendChild($arc_project_input)
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Trunk')
+ ->setLabel(pht('Trunk'))
->setName('trunkBranch')
->setValue($trunk_branch)
->setError($e_trunk_branch)
- ->setCaption('The development branch, '.
- 'from which requests will be picked.'))
+ ->setCaption(pht('The development branch, '.
+ 'from which requests will be picked.')))
->appendChild($branch_name_preview)
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton('/releeph/project/')
- ->setValue('Create'));
+ ->setValue(pht('Create')));
$panel = id(new AphrontPanelView())
- ->setHeader('Create Releeph Project')
+ ->setHeader(pht('Create Releeph Project'))
->appendChild($form)
->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(
array($error_view, $panel),
array(
- 'title' => 'Create new Releeph Project'
+ 'title' => pht('Create New Releeph Project')
));
}
}
diff --git a/src/applications/releeph/controller/project/ReleephProjectEditController.php b/src/applications/releeph/controller/project/ReleephProjectEditController.php
index 1dcb128e61..9dd7f7588c 100644
--- a/src/applications/releeph/controller/project/ReleephProjectEditController.php
+++ b/src/applications/releeph/controller/project/ReleephProjectEditController.php
@@ -1,388 +1,390 @@
<?php
final class ReleephProjectEditController extends ReleephController {
public function processRequest() {
$request = $this->getRequest();
$e_name = true;
$e_trunk_branch = true;
$e_branch_template = false;
$errors = array();
$project_name = $request->getStr('name',
$this->getReleephProject()->getName());
$phabricator_project_id = $request->getInt('projectID',
$this->getReleephProject()->getProjectID());
$trunk_branch = $request->getStr('trunkBranch',
$this->getReleephProject()->getTrunkBranch());
$branch_template = $request->getStr('branchTemplate');
if ($branch_template === null) {
$branch_template =
$this->getReleephProject()->getDetail('branchTemplate');
}
$pick_failure_instructions = $request->getStr('pickFailureInstructions',
$this->getReleephProject()->getDetail('pick_failure_instructions'));
$commit_author = $request->getStr('commitWithAuthor',
$this->getReleephProject()->getDetail('commitWithAuthor'));
$test_paths = $request->getStr('testPaths');
if ($test_paths !== null) {
$test_paths = array_filter(explode("\n", $test_paths));
} else {
$test_paths = $this->getReleephProject()->getDetail('testPaths', array());
}
$field_selector = $request->getStr('fieldSelector',
get_class($this->getReleephProject()->getReleephFieldSelector()));
$release_counter = $request->getInt(
'releaseCounter',
$this->getReleephProject()->getCurrentReleaseNumber());
$arc_project_id = $this->getReleephProject()->getArcanistProjectID();
if ($request->isFormPost()) {
$pusher_phids = $request->getArr('pushers');
if (!$project_name) {
- $e_name = 'Required';
+ $e_name = pht('Required');
$errors[] =
- 'Your releeph project should have a simple descriptive name';
+ pht('Your releeph project should have a simple descriptive name');
}
if (!$trunk_branch) {
- $e_trunk_branch = 'Required';
+ $e_trunk_branch = pht('Required');
$errors[] =
- 'You must specify which branch you will be picking from.';
+ pht('You must specify which branch you will be picking from.');
}
if ($release_counter && !is_int($release_counter)) {
- $errors[] = "Release counter must be a positive integer!";
+ $errors[] = pht("Release counter must be a positive integer!");
}
$other_releeph_projects = id(new ReleephProject())
->loadAllWhere('id <> %d', $this->getReleephProject()->getID());
$other_releeph_project_names = mpull($other_releeph_projects,
'getName', 'getID');
if (in_array($project_name, $other_releeph_project_names)) {
- $errors[] = "Releeph project name {$project_name} is already taken";
+ $errors[] = pht("Releeph project name %s is already taken",
+ $project_name);
}
foreach ($test_paths as $test_path) {
$result = @preg_match($test_path, '');
$is_a_valid_regexp = $result !== false;
if (!$is_a_valid_regexp) {
- $errors[] = 'Please provide a valid regular expression: '.
- "{$test_path} is not valid";
+ $errors[] = pht('Please provide a valid regular expression: '.
+ '%s is not valid', $test_path);
}
}
$project = $this->getReleephProject()
->setProjectID($phabricator_project_id)
->setTrunkBranch($trunk_branch)
->setDetail('pushers', $pusher_phids)
->setDetail('pick_failure_instructions', $pick_failure_instructions)
->setDetail('field_selector', $field_selector)
->setDetail('branchTemplate', $branch_template)
->setDetail('commitWithAuthor', $commit_author)
->setDetail('testPaths', $test_paths);
if ($release_counter) {
$project->setDetail('releaseCounter', $release_counter);
}
$fake_commit_handle =
ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id);
if ($branch_template) {
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
->setCommitHandle($fake_commit_handle)
->setReleephProjectName($project_name)
->interpolate($branch_template);
if ($template_errors) {
- $e_branch_template = 'Invalid!';
+ $e_branch_template = pht('Whoopsies!');
foreach ($template_errors as $template_error) {
$errors[] = "Template error: {$template_error}";
}
}
}
if (!$errors) {
$project->save();
return id(new AphrontRedirectResponse())
->setURI('/releeph/project/');
}
}
$error_view = null;
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setErrors($errors);
- $error_view->setTitle('Form Errors');
+ $error_view->setTitle(pht('Form Errors'));
}
$projects = mpull(
id(new PhabricatorProject())->loadAll(),
'getName',
'getID');
$projects[0] = '-'; // no project associated, that's ok
$pusher_phids = $request->getArr(
'pushers',
$this->getReleephProject()->getDetail('pushers', array()));
$handles = id(new PhabricatorObjectHandleData($pusher_phids))
->setViewer($request->getUser())
->loadHandles();
$pusher_tokens = array();
foreach ($pusher_phids as $phid) {
$pusher_tokens[$phid] = $handles[$phid]->getFullName();
}
$basic_inset = id(new AphrontFormInsetView())
- ->setTitle('Basics')
+ ->setTitle(pht('Basics'))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Name')
+ ->setLabel(pht('Name'))
->setName('name')
->setValue($project_name)
->setError($e_name)
- ->setCaption('A name like "Thrift" but not "Thrift releases".'))
+ ->setCaption(pht('A name like "Thrift" but not "Thrift releases".')))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel('Repository')
+ ->setLabel(pht('Repository'))
->setValue(
$this
->getReleephProject()
->loadPhabricatorRepository()
->getName()))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel('Arc Project')
+ ->setLabel(pht('Arc Project'))
->setValue(
$this->getReleephProject()->loadArcanistProject()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel('Releeph Project PHID')
+ ->setLabel(pht('Releeph Project PHID'))
->setValue(
$this->getReleephProject()->getPHID()))
->appendChild(
id(new AphrontFormSelectControl())
- ->setLabel('Phabricator Project')
+ ->setLabel(pht('Phabricator Project'))
->setValue($phabricator_project_id)
->setName('projectID')
->setOptions($projects))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Trunk')
+ ->setLabel(pht('Trunk'))
->setValue($trunk_branch)
->setName('trunkBranch')
->setError($e_trunk_branch))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Release counter')
+ ->setLabel(pht('Release counter'))
->setValue($release_counter)
->setName('releaseCounter')
->setCaption(
- "Used by the command line branch cutter's %N field"))
+ pht("Used by the command line branch cutter's %N field")))
->appendChild(
id(new AphrontFormTextAreaControl())
- ->setLabel('Pick Instructions')
+ ->setLabel(pht('Pick Instructions'))
->setValue($pick_failure_instructions)
->setName('pickFailureInstructions')
->setCaption(
- "Instructions for pick failures, which will be used " .
- "in emails generated by failed picks"))
+ pht("Instructions for pick failures, which will be used " .
+ "in emails generated by failed picks")))
->appendChild(
id(new AphrontFormTextAreaControl())
- ->setLabel('Tests paths')
+ ->setLabel(pht('Tests paths'))
->setValue(implode("\n", $test_paths))
->setName('testPaths')
->setCaption(
- 'List of strings that all test files contain in their path '.
+ pht('List of strings that all test files contain in their path '.
'in this project. One string per line. '.
- 'Examples: \'__tests__\', \'/javatests/\'...'));
+ 'Examples: \'__tests__\', \'/javatests/\'...')));
$pushers_inset = id(new AphrontFormInsetView())
- ->setTitle('Pushers')
+ ->setTitle(pht('Pushers'))
->appendChild(
- 'Pushers are allowed to approve Releeph requests to be committed. '.
+ pht('Pushers are allowed to approve Releeph requests to be committed. '.
'to this project\'s branches. If you leave this blank then anyone '.
- 'is allowed to approve requests.')
+ 'is allowed to approve requests.'))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setLabel('Pushers')
+ ->setLabel(pht('Pushers'))
->setName('pushers')
->setDatasource('/typeahead/common/users/')
->setValue($pusher_tokens));
$field_selector_options = array();
$field_selector_symbols = id(new PhutilSymbolLoader())
->setType('class')
->setConcreteOnly(true)
->setAncestorClass('ReleephFieldSelector')
->selectAndLoadSymbols();
foreach ($field_selector_symbols as $symbol) {
$selector_name = $symbol['name'];
$field_selector_options[$selector_name] = $selector_name;
}
- $field_selector_blurb = hsprintf(
+ $field_selector_blurb = pht(
"If you you have additional information to render about Releeph ".
"requests, or want to re-arrange the UI, implement a ".
"<tt>ReleephFieldSelector</tt> and select it here.");
$fields_inset = id(new AphrontFormInsetView())
- ->setTitle('Fields')
+ ->setTitle(pht('Fields'))
->appendChild($field_selector_blurb)
->appendChild(
id(new AphrontFormSelectControl())
- ->setLabel('Selector')
+ ->setLabel(pht('Selector'))
->setName('fieldSelector')
->setValue($field_selector)
->setOptions($field_selector_options));
$commit_author_inset = $this->buildCommitAuthorInset($commit_author);
// Build the Template inset
$markup_engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
// From DifferentialUnitFieldSpecification...
$markup_engine->setConfig('viewer', $request->getUser());
$help_markup = phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
phutil_safe_html(
$markup_engine->markupText(ReleephBranchTemplate::getHelpRemarkup())));
$branch_template_input = id(new AphrontFormTextControl())
->setName('branchTemplate')
->setValue($branch_template)
->setLabel('Template')
->setError($e_branch_template)
->setCaption(
- "Leave this blank to use your installation's default.");
+ pht("Leave this blank to use your installation's default."));
$branch_template_preview = id(new ReleephBranchPreviewView())
- ->setLabel('Preview')
+ ->setLabel(pht('Preview'))
->addControl('template', $branch_template_input)
->addStatic('arcProjectID', $arc_project_id)
->addStatic('isSymbolic', false)
->addStatic('projectName', $this->getReleephProject()->getName());
$template_inset = id(new AphrontFormInsetView())
- ->setTitle('Branch Cutting')
+ ->setTitle(pht('Branch Cutting'))
->appendChild(
- 'Provide a pattern for creating new branches.')
+ pht('Provide a pattern for creating new branches.'))
->appendChild($branch_template_input)
->appendChild($branch_template_preview)
->appendChild($help_markup);
// Build the form
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild($basic_inset)
->appendChild($pushers_inset)
->appendChild($fields_inset)
->appendChild($commit_author_inset)
->appendChild($template_inset);
$form
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton('/releeph/project/')
- ->setValue('Save'));
+ ->setValue(pht('Save')));
$panel = id(new AphrontPanelView())
- ->setHeader('Edit Releeph Project')
+ ->setHeader(pht('Edit Releeph Project'))
->appendChild($form)
->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse(
array($error_view, $panel),
- array('title' => 'Edit Releeph Project'));
+ array('title' => pht('Edit Releeph Project')));
}
private function buildCommitAuthorInset($current) {
$vcs_type = $this->getReleephProject()
->loadPhabricatorRepository()
->getVersionControlSystem();
switch ($vcs_type) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
return;
break;
}
$vcs_name = PhabricatorRepositoryType::getNameForRepositoryType($vcs_type);
+ // pht?
$help_markup = hsprintf(<<<EOTEXT
When your project's release engineers run <tt>arc releeph</tt>, they will be
listed as the <strong>committer</strong> of the code committed to release
branches.
%s allows you to specify a separate author when committing code. Some
tools use the author of a commit (rather than the committer) when they need to
notify someone about a build or test failure.
Releeph can use one of the following to set the <strong>author</strong> of the
commits it makes:
EOTEXT
, $vcs_name);
$trunk = $this->getReleephProject()->getTrunkBranch();
$options = array(
array(
'value' => ReleephProject::COMMIT_AUTHOR_FROM_DIFF,
- 'label' => 'Original Author',
+ 'label' => pht('Original Author'),
'caption' =>
- "The author of the original commit in {$trunk}.",
+ pht('The author of the original commit in: %s.', $trunk),
),
array(
'value' => ReleephProject::COMMIT_AUTHOR_REQUESTOR,
- 'label' => 'Requestor',
+ 'label' => pht('Requestor'),
'caption' =>
- "The person who requested that this code go into the release.",
+ pht('The person who requested that this code go into the release.'),
),
array(
'value' => ReleephProject::COMMIT_AUTHOR_NONE,
- 'label' => "None",
+ 'label' => pht('None'),
'caption' =>
- "Only record the default committer information.",
+ pht('Only record the default committer information.'),
),
);
if (!$current) {
$current = ReleephProject::COMMIT_AUTHOR_FROM_DIFF;
}
$control = id(new AphrontFormRadioButtonControl())
- ->setLabel('Author')
+ ->setLabel(pht('Author'))
->setName('commitWithAuthor')
->setValue($current);
foreach ($options as $dict) {
$control->addButton($dict['value'], $dict['label'], $dict['caption']);
}
return id(new AphrontFormInsetView())
- ->setTitle('Authors')
+ ->setTitle(pht('Authors'))
->appendChild($help_markup)
->appendChild($control);
}
}
diff --git a/src/applications/releeph/controller/project/ReleephProjectListController.php b/src/applications/releeph/controller/project/ReleephProjectListController.php
index 3c76d2ba5e..9f87e69fb9 100644
--- a/src/applications/releeph/controller/project/ReleephProjectListController.php
+++ b/src/applications/releeph/controller/project/ReleephProjectListController.php
@@ -1,95 +1,95 @@
<?php
final class ReleephProjectListController extends PhabricatorController {
private $filter;
public function willProcessRequest(array $data) {
$this->filter = idx($data, 'filter', 'active');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$query = id(new ReleephProjectQuery())
->setViewer($user)
->setOrder(ReleephProjectQuery::ORDER_NAME);
switch ($this->filter) {
case 'inactive':
$query->withActive(0);
$is_active = false;
break;
case 'active':
$query->withActive(1);
$is_active = true;
break;
default:
throw new Exception("Unknown filter '{$this->filter}'!");
}
$pager = new AphrontCursorPagerView();
$pager->readFromRequest($request);
$releeph_projects = $query->executeWithCursorPager($pager);
$releeph_projects_set = new LiskDAOSet();
foreach ($releeph_projects as $releeph_project) {
$releeph_projects_set->addToSet($releeph_project);
}
$panel = new AphrontPanelView();
if ($is_active) {
$view_inactive_link = phutil_tag(
'a',
array(
'href' => '/releeph/project/inactive/',
),
- 'View inactive projects');
+ pht('View inactive projects'));
$panel
->setHeader(hsprintf(
'Active Releeph Projects &middot; %s', $view_inactive_link))
->appendChild(
id(new ReleephActiveProjectListView())
->setUser($this->getRequest()->getUser())
->setReleephProjects($releeph_projects));
} else {
$view_active_link = phutil_tag(
'a',
array(
'href' => '/releeph/project/'
),
- 'View active projects');
+ pht('View active projects'));
$panel
->setHeader(hsprintf(
'Inactive Releeph Projects &middot; %s', $view_active_link))
->appendChild(
id(new ReleephInactiveProjectListView())
->setUser($this->getRequest()->getUser())
->setReleephProjects($releeph_projects));
}
if ($is_active) {
$create_new_project_button = phutil_tag(
'a',
array(
'href' => '/releeph/project/create/',
'class' => 'green button',
),
- 'Create New Project');
+ pht('Create New Project'));
$panel->addButton($create_new_project_button);
}
return $this->buildApplicationPage(
array(
$panel,
$pager,
),
array(
- 'title' => 'List Releeph Projects',
+ 'title' => pht('All Releeph Projects'),
));
}
}
diff --git a/src/applications/releeph/controller/project/ReleephProjectViewController.php b/src/applications/releeph/controller/project/ReleephProjectViewController.php
index 2706822468..88be74e649 100644
--- a/src/applications/releeph/controller/project/ReleephProjectViewController.php
+++ b/src/applications/releeph/controller/project/ReleephProjectViewController.php
@@ -1,45 +1,45 @@
<?php
final class ReleephProjectViewController extends ReleephController {
public function processRequest() {
// Load all branches
$releeph_project = $this->getReleephProject();
$releeph_branches = id(new ReleephBranch())
->loadAllWhere('releephProjectID = %d',
$releeph_project->getID());
$path = $this->getRequest()->getRequestURI()->getPath();
$is_open_branches = strpos($path, 'closedbranches/') === false;
$view = id(new ReleephProjectView())
->setShowOpenBranches($is_open_branches)
->setUser($this->getRequest()->getUser())
->setReleephProject($releeph_project)
->setBranches($releeph_branches);
$crumbs = $this->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
->setName($releeph_project->getName())
->setHref($releeph_project->getURI()));
if ($releeph_project->getIsActive()) {
$crumbs->addAction(
id(new PhabricatorMenuItemView())
->setHref($releeph_project->getURI('cutbranch'))
- ->setName('Cut New Branch')
+ ->setName(pht('Cut New Branch'))
->setIcon('create'));
}
return $this->buildStandardPageResponse(
array(
$crumbs,
$view,
),
array(
- 'title' => $releeph_project->getName().' Releeph Project'
+ 'title' => $releeph_project->getName()
));
}
}
diff --git a/src/applications/releeph/controller/request/ReleephRequestCreateController.php b/src/applications/releeph/controller/request/ReleephRequestCreateController.php
index 21415fc54a..c72a579a69 100644
--- a/src/applications/releeph/controller/request/ReleephRequestCreateController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestCreateController.php
@@ -1,165 +1,165 @@
<?php
final class ReleephRequestCreateController extends ReleephController {
const MAX_SUMMARY_LENGTH = 70;
public function processRequest() {
$request = $this->getRequest();
// We arrived via /releeph/request/create/?branchID=$id
$releeph_branch_id = $request->getInt('branchID');
if ($releeph_branch_id) {
$releeph_branch = id(new ReleephBranch())->load($releeph_branch_id);
} else {
// We arrived via /releeph/$project/$branch/request.
//
// If this throws an Exception, then somethind weird happened.
$releeph_branch = $this->getReleephBranch();
}
$releeph_project = $releeph_branch->loadReleephProject();
$repo = $releeph_project->loadPhabricatorRepository();
$request_identifier = $request->getStr('requestIdentifierRaw');
$e_request_identifier = true;
$releeph_request = new ReleephRequest();
$errors = array();
$selector = $releeph_project->getReleephFieldSelector();
$fields = $selector->getFieldSpecifications();
foreach ($fields as $field) {
$field
->setReleephProject($releeph_project)
->setReleephBranch($releeph_branch)
->setReleephRequest($releeph_request);
}
if ($request->isFormPost()) {
foreach ($fields as $field) {
if ($field->isEditable()) {
try {
$field->setValueFromAphrontRequest($request);
} catch (ReleephFieldParseException $ex) {
$errors[] = $ex->getMessage();
}
}
}
$pr_commit = null;
$finder = id(new ReleephCommitFinder())
->setReleephProject($releeph_project);
try {
$pr_commit = $finder->fromPartial($request_identifier);
} catch (Exception $e) {
- $e_request_identifier = 'Invalid';
+ $e_request_identifier = pht('Invalid');
$errors[] =
- "Request {$request_identifier} is probably not a valid commit";
+ pht('Request %s is probably not a valid commit', $request_identifier);
$errors[] = $e->getMessage();
}
$pr_commit_data = null;
if (!$errors) {
$pr_commit_data = $pr_commit->loadCommitData();
if (!$pr_commit_data) {
- $e_request_identifier = 'Not parsed yet';
- $errors[] = "The requested commit hasn't been parsed yet.";
+ $e_request_identifier = pht('Not parsed yet');
+ $errors[] = pht('The requested commit hasn\'t been parsed yet.');
}
}
if (!$errors) {
$existing = id(new ReleephRequest())
->loadOneWhere('requestCommitPHID = %s AND branchID = %d',
$pr_commit->getPHID(), $releeph_branch->getID());
if ($existing) {
return id(new AphrontRedirectResponse())
->setURI('/releeph/request/edit/'.$existing->getID().
'?existing=1');
}
id(new ReleephRequestEditor($releeph_request))
->setActor($request->getUser())
->create($pr_commit, $releeph_branch);
return id(new AphrontRedirectResponse())
->setURI($releeph_branch->getURI());
}
}
$error_view = null;
if ($errors) {
$error_view = new AphrontErrorView();
$error_view->setErrors($errors);
- $error_view->setTitle('Form Errors');
+ $error_view->setTitle(pht('Form Errors'));
}
// For the typeahead
$branch_cut_point = id(new PhabricatorRepositoryCommit())
->loadOneWhere(
'phid = %s',
$releeph_branch->getCutPointCommitPHID());
// Build the form
$form = id(new AphrontFormView())
->setUser($request->getUser());
$origin = null;
$diff_rev_id = $request->getStr('D');
if ($diff_rev_id) {
$diff_rev = id(new DifferentialRevision())->load($diff_rev_id);
$origin = '/D'.$diff_rev->getID();
$title = sprintf(
'D%d: %s',
$diff_rev_id,
$diff_rev->getTitle());
$form
->addHiddenInput('requestIdentifierRaw', 'D'.$diff_rev_id)
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel('Diff')
+ ->setLabel(pht('Diff'))
->setValue($title));
} else {
$origin = $releeph_branch->getURI();
$form->appendChild(
id(new ReleephRequestTypeaheadControl())
->setName('requestIdentifierRaw')
->setLabel('Commit ID')
->setRepo($repo)
->setValue($request_identifier)
->setError($e_request_identifier)
->setStartTime($branch_cut_point->getEpoch())
->setCaption(
- 'Start typing to autocomplete on commit title, '.
- 'or give a Phabricator commit identifier like rFOO1234'));
+ pht('Start typing to autocomplete on commit title, '.
+ 'or give a Phabricator commit identifier like rFOO1234')));
}
// Fields
foreach ($fields as $field) {
if ($field->isEditable()) {
$control = $field->renderEditControl($request);
$form->appendChild($control);
}
}
$form
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($origin)
- ->setValue('Request'));
+ ->setValue(pht('Request')));
$panel = id(new AphrontPanelView())
->setHeader(
- 'Request for '.
- $releeph_branch->getDisplayNameWithDetail())
+ pht('Request for %s',
+ $releeph_branch->getDisplayNameWithDetail()))
->setWidth(AphrontPanelView::WIDTH_FORM)
->appendChild($form);
return $this->buildStandardPageResponse(
array($error_view, $panel),
- array('title' => 'Request pick'));
+ array('title' => pht('Request Pick')));
}
}
diff --git a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
index 881bdf807e..791c31f1e5 100644
--- a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
@@ -1,99 +1,99 @@
<?php
final class ReleephRequestDifferentialCreateController
extends ReleephController {
private $revision;
public function willProcessRequest(array $data) {
$diff_rev_id = $data['diffRevID'];
$diff_rev = id(new DifferentialRevision())->load($diff_rev_id);
if (!$diff_rev) {
throw new Exception(sprintf('D%d not found!', $diff_rev_id));
}
$this->revision = $diff_rev;
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$arc_project = id(new PhabricatorRepositoryArcanistProject())
->loadOneWhere('phid = %s', $this->revision->getArcanistProjectPHID());
$projects = id(new ReleephProject())->loadAllWhere(
'arcanistProjectID = %d AND isActive = 1',
$arc_project->getID());
if (!$projects) {
throw new ReleephRequestException(sprintf(
"D%d belongs to the '%s' Arcanist project, ".
"which is not part of any Releeph project!",
$this->revision->getID(),
$arc_project->getName()));
}
$branches = id(new ReleephBranch())->loadAllWhere(
'releephProjectID IN (%Ld) AND isActive = 1',
mpull($projects, 'getID'));
if (!$branches) {
throw new ReleephRequestException(sprintf(
"D%d could be in the Releeph project(s) %s, ".
"but this project / none of these projects have open branches.",
$this->revision->getID(),
implode(', ', mpull($projects, 'getName'))));
}
if (count($branches) === 1) {
return id(new AphrontRedirectResponse())
->setURI($this->buildReleephRequestURI(head($branches)));
}
$projects = msort(
mpull($projects, null, 'getID'),
'getName');
$branch_groups = mgroup($branches, 'getReleephProjectID');
require_celerity_resource('releeph-request-differential-create-dialog');
$dialog = id(new AphrontDialogView())
->setUser($user)
- ->setTitle('Choose Releeph Branch')
+ ->setTitle(pht('Choose Releeph Branch'))
->setClass('releeph-request-differential-create-dialog')
->addCancelButton('/D'.$request->getStr('D'));
$dialog->appendChild(
- "This differential revision changes code that is associated ".
+ pht("This differential revision changes code that is associated ".
"with multiple Releeph branches. ".
- "Please select the branch where you would like this code to be picked.");
+ "Please select the branch where you would like this code to be picked."));
foreach ($branch_groups as $project_id => $branches) {
$project = idx($projects, $project_id);
$dialog->appendChild(
phutil_tag(
'h1',
array(),
$project->getName()));
$branches = msort($branches, 'getBasename');
foreach ($branches as $branch) {
$uri = $this->buildReleephRequestURI($branch);
$dialog->appendChild(
phutil_tag(
'a',
array(
'href' => $uri,
),
$branch->getDisplayNameWithDetail()));
}
}
return id(new AphrontDialogResponse)
->setDialog($dialog);
}
private function buildReleephRequestURI(ReleephBranch $branch) {
return id(new PhutilURI('/releeph/request/create/'))
->setQueryParam('branchID', $branch->getID())
->setQueryParam('D', $this->revision->getID());
}
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 14, 10:09 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
336924
Default Alt Text
(63 KB)

Event Timeline