/**
  * Runs the command and returns it's output.
  *
  * @param array $input   Command input.
  * @param array $options Command tester options.
  *
  * @return string
  */
 protected function runCommand(array $input = array(), array $options = array())
 {
     $input['command'] = $this->command->getName();
     $options['interactive'] = true;
     $this->commandTester->execute($input, $options);
     return $this->commandTester->getDisplay();
 }
예제 #2
0
 /**
  * Validates command setting usage.
  *
  * @param string          $name     Name.
  * @param AbstractCommand $command  Command to get settings from.
  * @param string          $raw_path Raw path.
  *
  * @return AbstractConfigSetting
  * @throws \LogicException When command don't have any config settings to provide.
  */
 protected function getSetting($name, AbstractCommand $command, $raw_path)
 {
     if (!$command instanceof IConfigAwareCommand) {
         throw new \LogicException('The "' . $command->getName() . '" command does not have any settings.');
     }
     $config_setting = $this->findSetting($name, $command->getConfigSettings(), $command->getName());
     if ($config_setting->isWithinScope(AbstractConfigSetting::SCOPE_WORKING_COPY)) {
         $config_setting->setWorkingCopyUrl($this->workingCopyResolver->getWorkingCopyUrl($raw_path));
     }
     $config_setting->setEditor($this->configEditor);
     return $config_setting;
 }
예제 #3
0
 /**
  * Prepare dependencies.
  *
  * @return void
  */
 protected function prepareDependencies()
 {
     parent::prepareDependencies();
     $container = $this->getContainer();
     $this->_revisionListParser = $container['revision_list_parser'];
     $this->_editor = $container['editor'];
 }
예제 #4
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $description = <<<TEXT
TODO
TEXT;
        $this->setName('resolve')->setDescription('Interactively resolves working copy conflicts')->setHelp($description)->addArgument('path', InputArgument::OPTIONAL, 'Working copy path', '.');
        parent::configure();
    }
예제 #5
0
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if ($optionName === 'revisions') {
         return array('all');
     }
     return $ret;
 }
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if ($optionName === 'extension') {
         return $this->_migrationManager->getMigrationFileExtensions();
     }
     return $ret;
 }
예제 #7
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $description = <<<TEXT
TODO
TEXT;
        $this->setName('revert')->setDescription('Restore pristine working copy file (undo most local edits)')->setHelp($description)->addArgument('path', InputArgument::OPTIONAL, 'Working copy path', '.');
        parent::configure();
    }
예제 #8
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $description = <<<TEXT
TODO
TEXT;
        $this->setName('update')->setDescription('Bring changes from the repository into the working copy.')->setHelp($description)->setAliases(array('up'))->addArgument('path', InputArgument::OPTIONAL, 'Working copy path', '.');
        parent::configure();
    }
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if ($optionName === 'stability') {
         return $this->_getStabilities();
     }
     return $ret;
 }
예제 #10
0
 /**
  * Return possible values for the named argument
  *
  * @param string            $argumentName Argument name.
  * @param CompletionContext $context      Completion context.
  *
  * @return array
  */
 public function completeArgumentValues($argumentName, CompletionContext $context)
 {
     $ret = parent::completeArgumentValues($argumentName, $context);
     if ($argumentName === 'sub-command') {
         return $this->getSubCommands();
     }
     return $ret;
 }
예제 #11
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $description = <<<TEXT
TODO
TEXT;
        $this->setName('cleanup')->setDescription('Recursively clean up the working copy, removing locks, resuming unfinished operations, etc.')->setHelp($description)->addArgument('path', InputArgument::OPTIONAL, 'Working copy path', '.');
        parent::configure();
    }
예제 #12
0
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if ($optionName === 'mode') {
         return $this->getModes();
     }
     return $ret;
 }
예제 #13
0
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if (in_array($optionName, array('show', 'edit', 'delete'))) {
         return array_keys($this->configSettings);
     }
     return $ret;
 }
예제 #14
0
 /**
  * Prepare dependencies.
  *
  * @return void
  */
 protected function prepareDependencies()
 {
     parent::prepareDependencies();
     $container = $this->getContainer();
     $this->_editor = $container['editor'];
     $this->_commitMessageBuilder = $container['commit_message_builder'];
     $this->_mergeTemplateFactory = $container['merge_template_factory'];
     $this->_workingCopyConflictTracker = $container['working_copy_conflict_tracker'];
 }
예제 #15
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this->pathAcceptsUrl = true;
        $description = <<<TEXT
TODO
TEXT;
        $this->setName('log')->setDescription('Show the log messages for revisions/bugs/path')->setHelp($description)->addArgument('path', InputArgument::OPTIONAL, 'Working copy path or URL', '.')->addOption('revisions', 'r', InputOption::VALUE_REQUIRED, 'Revision or revision range (e.g. "53324,34342,1224-4433,232")')->addOption('bugs', 'b', InputOption::VALUE_REQUIRED, 'Bugs to merge (e.g. "JRA-1234,43644")')->addOption('details', 'd', InputOption::VALUE_NONE, 'Shows path affected in each revision')->addOption('merge-oracle', null, InputOption::VALUE_NONE, 'Detects commits with possible merge conflicts')->addOption('limit', null, InputOption::VALUE_REQUIRED, 'Maximum number of log entries');
        parent::configure();
    }
예제 #16
0
 /**
  * Returns all refs.
  *
  * @return array
  */
 protected function getAllRefs()
 {
     $ret = parent::getAllRefs();
     $ret[] = self::ALL_REFS;
     return $ret;
 }
 /**
  * Prepare dependencies.
  *
  * @return void
  */
 protected function prepareDependencies()
 {
     parent::prepareDependencies();
     $container = $this->getContainer();
     $this->_configEditor = $container['config_editor'];
 }
예제 #18
0
 /**
  * Return possible values for the named option
  *
  * @param string            $optionName Option name.
  * @param CompletionContext $context    Completion context.
  *
  * @return array
  */
 public function completeOptionValues($optionName, CompletionContext $context)
 {
     $ret = parent::completeOptionValues($optionName, $context);
     if ($optionName === 'revisions') {
         return array('all');
     }
     if ($optionName === 'source-url') {
         return $this->getAllRefs();
     }
     if ($optionName === 'auto-commit') {
         return array('yes', 'no');
     }
     return $ret;
 }
예제 #19
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     $this->setName('update')->setDescription('Bring changes from the repository into the working copy')->setAliases(array('up'))->addArgument('path', InputArgument::OPTIONAL, 'Working copy path', '.')->addOption('revision', 'r', InputOption::VALUE_REQUIRED, 'Update working copy to specified revision, e.g. <comment>NUMBER</comment>, <comment>{DATE}</comment>, <comment>HEAD</comment>, <comment>BASE</comment>, <comment>COMMITTED</comment>, <comment>PREV</comment>')->addOption('ignore-externals', null, InputOption::VALUE_NONE, 'Ignore externals definitions');
     parent::configure();
 }