当前位置: 首页>>代码示例>>PHP>>正文


PHP Branch::getName方法代码示例

本文整理汇总了PHP中Branch::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Branch::getName方法的具体用法?PHP Branch::getName怎么用?PHP Branch::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Branch的用法示例。


在下文中一共展示了Branch::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: synchronize

 /**
  * @static
  * @param GitCommand $gitCommand
  * @param Repository $repository
  * @param Branch $branch
  * @param bool $deleteOnly
  * @return void
  */
 public static function synchronize(GitCommand $gitCommand, Repository $repository, Branch $branch, $deleteOnly = false)
 {
     $branchGit = $gitCommand->getNoMergedBranchInfos($repository->getGitDir(), $branch->getBaseBranchName(), $branch->getName());
     $branchModel = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByName($branch->getName())->findOne();
     if ($branchModel) {
         if (is_null($branchGit)) {
             $branchModel->delete();
         } elseif (!$branchModel->getIsBlacklisted() && !$deleteOnly) {
             $lastSynchronizationCommit = $branchModel->getLastCommit();
             $branchModel->setCommitReference($branchGit['commit_reference']);
             $branchModel->setLastCommit($branchGit['last_commit']);
             $branchModel->setLastCommitDesc($branchGit['last_commit_desc']);
             $branchModel->save();
             return FilePeer::synchronize($gitCommand, $branchModel, $lastSynchronizationCommit);
         }
     }
     return 0;
 }
开发者ID:ratibus,项目名称:Crew,代码行数:26,代码来源:BranchPeer.php

示例2: synchronize

 /**
  * @static
  * @param GitCommand $gitCommand
  * @param Branch $branch
  * @param string $lastBranchSynchronizationCommit
  * @return int 0 if succeed
  */
 public static function synchronize(GitCommand $gitCommand, Branch $branch, $lastBranchSynchronizationCommit = null)
 {
     $filesGit = $gitCommand->getDiffFilesFromBranch($branch->getRepository()->getGitDir(), $branch->getCommitReference(), $branch->getLastCommit());
     if (count($filesGit) > sfConfig::get('app_max_number_of_files_to_review', 4096)) {
         return count($filesGit);
     }
     $filesModel = FileQuery::create()->filterByBranchId($branch->getId())->find();
     if (count($filesModel) > 0) {
         $diffFilesFromLastSynch = $gitCommand->getDiffFilesFromBranch($branch->getRepository()->getGitDir(), !is_null($lastBranchSynchronizationCommit) ? $lastBranchSynchronizationCommit : $branch->getCommitReference(), $branch->getLastCommit(), false);
     }
     foreach ($filesModel as $fileModel) {
         /** @var $fileModel File */
         if (!array_key_exists($fileModel->getFilename(), $filesGit)) {
             $fileModel->delete();
         } else {
             $lastChangeCommit = $gitCommand->getLastModificationCommit($branch->getRepository()->getGitDir(), $branch->getName(), $fileModel->getFilename());
             if (isset($diffFilesFromLastSynch[$fileModel->getFilename()])) {
                 $fileModel->setReviewRequest(true)->setStatus(BranchPeer::A_TRAITER)->setCommitStatusChanged($lastChangeCommit);
             } else {
                 $fileModel->setReviewRequest(false);
             }
             if ($filesGit[$fileModel->getFilename()]['is-binary']) {
                 $fileModel->setIsBinary(true)->setNbAddedLines(0)->setNbDeletedLines(0);
             } else {
                 $fileModel->setIsBinary(false)->setNbAddedLines($filesGit[$fileModel->getFilename()]['added-lines'])->setNbDeletedLines($filesGit[$fileModel->getFilename()]['deleted-lines']);
             }
             $fileModel->setState($filesGit[$fileModel->getFilename()]['state'])->setLastChangeCommit($lastChangeCommit)->setCommitInfos($gitCommand->getCommitInfos($branch->getRepository()->getGitDir(), $lastChangeCommit, "%ce %s"))->setCommitReference($branch->getCommitReference())->save();
         }
         unset($filesGit[$fileModel->getFilename()]);
     }
     foreach ($filesGit as $fileGit) {
         $lastChangeCommit = $gitCommand->getLastModificationCommit($branch->getRepository()->getGitDir(), $branch->getName(), $fileGit['filename']);
         $file = new File();
         if ($fileGit['is-binary']) {
             $file->setIsBinary(true)->setNbAddedLines(0)->setNbDeletedLines(0);
         } else {
             $file->setIsBinary(false)->setNbAddedLines($fileGit['added-lines'])->setNbDeletedLines($fileGit['deleted-lines']);
         }
         $file->setFilename($fileGit['filename'])->setStatus(BranchPeer::A_TRAITER)->setState($fileGit['state'])->setBranchId($branch->getId())->setLastChangeCommit($lastChangeCommit)->setCommitInfos($gitCommand->getCommitInfos($branch->getRepository()->getGitDir(), $lastChangeCommit, "%ce %s"))->setCommitReference($branch->getCommitReference())->setReviewRequest(true)->save();
     }
     return 0;
 }
开发者ID:ratibus,项目名称:Crew,代码行数:49,代码来源:FilePeer.php

示例3: getCommits

 /**
  * @param Branch $branch
  *
  * @return Commit[]
  */
 public function getCommits(Branch $branch)
 {
     exec(sprintf('git log --pretty=format:"%s" %s', self::PRETTY_FORMAT_STRING, $branch->getName()), $output);
     $commits = [];
     $commitData = [];
     foreach ($output as $line) {
         if (empty($line)) {
             $commits[$commitData['H']] = new Commit(new Hash($commitData['H']), new User($commitData['aN'], $commitData['aE']), new \DateTime($commitData['ai']), new User($commitData['cN'], $commitData['cE']), new \DateTime($commitData['ci']), $commitData['s']);
             continue;
         }
         if (false === strpos($line, ':')) {
             continue;
         }
         list($key, $value) = explode(':', $line, 2);
         $commitData[$key] = $value;
     }
     return $commits;
 }
开发者ID:phpeople,项目名称:git-log-parser,代码行数:23,代码来源:GitLogParser.php

示例4: executeAddbranch

 public function executeAddbranch()
 {
     $c = new Criteria();
     $c->add(BranchPeer::NAME, $this->getRequestParameter('branch'));
     $exbranch = BranchPeer::doSelectOne($c);
     $c->clear();
     $c->add(BranchPeer::CODE, $this->getRequestParameter('code'));
     $excode = BranchPeer::doSelectOne($c);
     if ($exbranch) {
         $this->setFlash('notice', 'Branch could not be added. A branch with this name already exists.');
     } elseif ($excode) {
         $this->setFlash('notice', 'Branch could not be added. A branch with this code already exists.');
     } else {
         $branch = new Branch();
         $branch->setName($this->getRequestParameter('branch'));
         $branch->setCode($this->getRequestParameter('code'));
         $branch->save();
         $this->setFlash('notice', 'Branch <b>' . $branch->getName() . '</b> with code <b>' . $branch->getCode() . '</b> added successfully.');
     }
     $this->redirect('/admin/branches');
 }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:21,代码来源:actions.class.php


注:本文中的Branch::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。