/** * @param int $id */ public function initAction($id, $grantType = 'VIEW') { $redirectUrl = parent::initAction($id, $grantType); if ($redirectUrl) { return $redirectUrl; } $this->gitSyncCommands = $this->gitCommands->command('sync'); }
/** * Creates a form to edit a Project entity. * * @param Project $project The entity * * @return \Symfony\Component\Form\Form The form */ private function createPushPullForm($project, $formAction = 'project_pushremote') { //Remote Server choice $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $remoteChoices = array(); foreach ($gitRemoteVersions as $remoteVersion) { $remoteChoices[$remoteVersion[0] . '(' . $remoteVersion[1] . ')'] = $remoteVersion[0]; } //Local Branch choice $branches = $this->gitCommands->command('branch')->getBranches(true); $branchChoices = array(); foreach ($branches as $branchName) { $branchChoices[$branchName] = $branchName; } //Current branch $currentBranch = $this->gitCommands->command('branch')->getCurrentBranch(); $firstOrigin = reset($remoteChoices); $defaultData = array('branch' => $currentBranch); $form = $this->createFormBuilder($defaultData, array('action' => $this->generateUrl($formAction, array('id' => $project->getId())), 'method' => 'POST'))->add('remote', ChoiceType::class, array('label' => 'Remote Server', 'choices' => $remoteChoices, 'data' => $firstOrigin, 'required' => false, 'choices_as_values' => true, 'constraints' => array(new NotBlank())))->add('branch', ChoiceType::class, array('label' => 'Branch', 'choices' => $branchChoices, 'preferred_choices' => array($currentBranch), 'data' => trim($currentBranch), 'required' => false, 'choices_as_values' => true, 'constraints' => array(new NotBlank())))->getForm(); //$form->add('submitMain', SubmitType::class, array('label' => 'Push')); return $form; }
public function __construct(GitCommand $gitCommand, ProjectEnvironmentStorage $projectEnvironmentStorage) { $this->gitStatusCommand = $gitCommand->command('status'); $this->projectEnvironmentStorage = $projectEnvironmentStorage; }
/** * @param string $colorHex * * @return string */ public function isFileIgnored($filePath) { return $this->gitCommand->command('files')->isFileIgnored($filePath); }