1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02: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:
James Rhodes 2013-11-09 15:08:34 -08:00 committed by epriestley
parent 79ef667dfd
commit eccbbce9a2
3 changed files with 10 additions and 3 deletions

View file

@ -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())

View file

@ -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');
}

View file

@ -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.'),