コード例 #1
0
 /**
  * MergeCommand should throw an exception when both --ff-only and --no-ff flags were set.
  *
  * @expectedException \Symfony\Component\Process\Exception\InvalidArgumentException
  */
 public function test_exception_when_calling_merge_with_conflicting_ff_arguments()
 {
     $branch = $this->getRepository()->getBranch('test');
     MergeCommand::getInstance()->merge($branch, "test msg", array('--ff-only', '--no-ff'));
 }
コード例 #2
0
ファイル: Repository.php プロジェクト: mlukman/gitsync
 /**
  * Merge a Branch in the current checked out branch
  *
  * @param Objects\Branch $branch  The branch to merge in the current checked out branch
  * @param string         $message The message for the merge commit, if merge is 3-way
  * @param string         $mode    The merge mode: ff-only, no-ff or auto
  *
  * @throws \RuntimeException
  * @throws \Symfony\Component\Process\Exception\LogicException
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  * @return Repository
  */
 public function merge(Branch $branch, $message = '', $mode = 'auto')
 {
     $valid_modes = array('auto', 'ff-only', 'no-ff');
     if (!in_array($mode, $valid_modes)) {
         throw new \Symfony\Component\Process\Exception\InvalidArgumentException("Invalid merge mode: {$mode}.");
     }
     $options = array();
     switch ($mode) {
         case 'ff-only':
             $options[] = MergeCommand::MERGE_OPTION_FF_ONLY;
             break;
         case 'no-ff':
             $options[] = MergeCommand::MERGE_OPTION_NO_FF;
             break;
     }
     $this->caller->execute(MergeCommand::getInstance($this)->merge($branch, $message, $options));
     return $this;
 }