mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 03:08:40 +01:00
Allow users to create buildables from diffs
Summary: Now that diffs have PHIDs we can create buildables for them. This also adds `buildable.diff` in the variables list so the diff ID is available, and it also fixes the Cancel button on "Edit Plan" page so it redirects to the right place. Test Plan: Created a buildable from a diff, ran a build plan against it that had `echo ${buildable.diff}` and got the right ID. Also tested the "Edit Plan" cancel redirect. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T1049 Differential Revision: https://secure.phabricator.com/D7546
This commit is contained in:
parent
79ef667dfd
commit
eccbbce9a2
3 changed files with 10 additions and 3 deletions
|
@ -42,8 +42,11 @@ final class HarbormasterBuildableEditController
|
|||
->executeOne();
|
||||
|
||||
if ($object instanceof DifferentialRevision) {
|
||||
throw new Exception(
|
||||
"TODO: We need to assign PHIDs to diffs before this will work.");
|
||||
$revision = $object;
|
||||
$object = $object->loadActiveDiff();
|
||||
$buildable
|
||||
->setBuildablePHID($object->getPHID())
|
||||
->setContainerPHID($revision->getPHID());
|
||||
} else if ($object instanceof PhabricatorRepositoryCommit) {
|
||||
$buildable
|
||||
->setBuildablePHID($object->getPHID())
|
||||
|
|
|
@ -68,7 +68,7 @@ final class HarbormasterPlanEditController
|
|||
$id = $plan->getID();
|
||||
|
||||
$title = pht('Edit Build Plan');
|
||||
$cancel_uri = "/B{$id}";
|
||||
$cancel_uri = $this->getApplicationURI('plan/'.$plan->getID().'/');
|
||||
$save_button = pht('Save Build Plan');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ abstract class VariableBuildStepImplementation extends BuildStepImplementation {
|
|||
|
||||
public function retrieveVariablesFromBuild(HarbormasterBuild $build) {
|
||||
$results = array(
|
||||
'buildable.diff' => null,
|
||||
'buildable.revision' => null,
|
||||
'buildable.commit' => null,
|
||||
'repository.callsign' => null,
|
||||
|
@ -17,6 +18,7 @@ abstract class VariableBuildStepImplementation extends BuildStepImplementation {
|
|||
|
||||
$repo = null;
|
||||
if ($object instanceof DifferentialDiff) {
|
||||
$results['buildable.diff'] = $object->getID();
|
||||
$revision = $object->getRevision();
|
||||
$results['buildable.revision'] = $revision->getID();
|
||||
$repo = $revision->getRepository();
|
||||
|
@ -72,6 +74,8 @@ abstract class VariableBuildStepImplementation extends BuildStepImplementation {
|
|||
|
||||
public function getAvailableVariables() {
|
||||
return array(
|
||||
'buildable.diff' =>
|
||||
pht('The differential diff ID, if applicable.'),
|
||||
'buildable.revision' =>
|
||||
pht('The differential revision ID, if applicable.'),
|
||||
'buildable.commit' => pht('The commit identifier, if applicable.'),
|
||||
|
|
Loading…
Add table
Reference in a new issue