• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP GitRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getEvent

 private function getEvent(GitRepository $repository)
 {
     if (!isset($this->cache[$repository->getId()])) {
         $this->cache[$repository->getId()] = $this->dao->getSystemEventForRepository($repository->getId());
     }
     return $this->cache[$repository->getId()];
 }
开发者ID:blestab,项目名称:tuleap,代码行数:7,代码来源:ProjectCreatorStatus.php


示例2: getRepository

 /**
  * Wrapper for GitRepository for unit testing purpose
  *
  * @param array $row data of the repository to instantiate
  *
  * @return GitRepository
  */
 protected function getRepository($row)
 {
     $r = new GitRepository();
     $r->setId($row[GitDao::REPOSITORY_ID]);
     $r->load();
     return $r;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:GitViewsRepositoriesTraversalStrategy.class.php


示例3: getItemWrapper

 /**
  * Get Item wrapper
  *
  * @param GitRepository $repo  the string representation of the item
  * @param string        $inner the string representation of the item
  *
  * @return string the $inner encapsulated in its own wrapper
  */
 protected function getItemWrapper(GitRepository $repo, $inner)
 {
     if ($repo->getBackend() instanceof Git_Backend_Gitolite) {
         return '<option value="' . $repo->getId() . '">' . $inner . '</option>';
     }
     return '';
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:15,代码来源:GitViewsRepositoriesTraversalStrategy_Selectbox.class.php


示例4: getPushDetails

 /**
  *
  * Behaviour extracted from official email hook prep_for_email() function
  *
  * @param GitRepository $repository
  * @param PFUser $user
  * @param type $oldrev
  * @param type $newrev
  * @param type $refname
  * @return Git_Hook_PushDetails
  */
 public function getPushDetails(GitRepository $repository, PFUser $user, $oldrev, $newrev, $refname)
 {
     $change_type = Git_Hook_PushDetails::ACTION_ERROR;
     $revision_list = array();
     $rev_type = '';
     try {
         if ($oldrev == self::FAKE_EMPTY_COMMIT) {
             $revision_list = $this->exec_repo->revListSinceStart($refname, $newrev);
             $change_type = Git_Hook_PushDetails::ACTION_CREATE;
         } elseif ($newrev == self::FAKE_EMPTY_COMMIT) {
             $change_type = Git_Hook_PushDetails::ACTION_DELETE;
         } else {
             $revision_list = $this->exec_repo->revList($oldrev, $newrev);
             $change_type = Git_Hook_PushDetails::ACTION_UPDATE;
         }
         if ($change_type == Git_Hook_PushDetails::ACTION_DELETE) {
             $rev_type = $this->exec_repo->getObjectType($oldrev);
         } else {
             $rev_type = $this->exec_repo->getObjectType($newrev);
         }
     } catch (Git_Command_Exception $exception) {
         $this->logger->error(__CLASS__ . " {$repository->getFullName()} {$refname} {$oldrev} {$newrev} " . $exception->getMessage());
     }
     return new Git_Hook_PushDetails($repository, $user, $refname, $change_type, $rev_type, $revision_list);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:36,代码来源:LogAnalyzer.class.php


示例5: process

 public function process()
 {
     $parameters = $this->getParametersAsArray();
     //repo id
     $repositoryId = '';
     if (!empty($parameters[0])) {
         $repositoryId = $parameters[0];
     } else {
         $this->error('Missing argument repository id');
         return false;
     }
     //repo access
     $repositoryAccess = '';
     if (!empty($parameters[1])) {
         $repositoryAccess = $parameters[1];
     } else {
         $this->error('Missing argument repository access');
         return false;
     }
     //save
     $repository = new GitRepository();
     $repository->setId($repositoryId);
     try {
         $repository->load();
         $repository->setAccess($repositoryAccess);
         $repository->changeAccess();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     }
     $this->done();
 }
开发者ID:nterray,项目名称:tuleap,代码行数:32,代码来源:SystemEvent_GIT_REPO_ACCESS.class.php


示例6: getRepositoryBaseUrl

 /**
  * @param GitRepository $repository
  * @return string the base url to access the git repository regarding plugin configuration
  */
 public function getRepositoryBaseUrl(GitRepository $repository)
 {
     if ($this->git_plugin->areFriendlyUrlsActivated()) {
         return GIT_BASE_URL . '/' . $repository->getProject()->getUnixName() . '/' . $repository->getFullName();
     } else {
         return GIT_BASE_URL . '/index.php/' . $repository->getProjectId() . '/view/' . $repository->getId() . '/';
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:GitRepositoryUrlManager.class.php


示例7: updateRepositoryMirrors

 public function updateRepositoryMirrors(GitRepository $repository, array $mirror_ids)
 {
     if ($this->mirror_data_mapper->doesAllSelectedMirrorIdsExist($mirror_ids) && $this->mirror_data_mapper->unmirrorRepository($repository->getId()) && $this->mirror_data_mapper->mirrorRepositoryTo($repository->getId(), $mirror_ids)) {
         $this->history_dao->groupAddHistory("git_repo_mirroring_update", $repository->getName(), $repository->getProjectId());
         return true;
     }
     return false;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:8,代码来源:MirrorUpdater.php


示例8: canBeReadByAnonymous

 private function canBeReadByAnonymous(GitRepository $repository)
 {
     $ugroup_ids = $this->permissions_manager->getAuthorizedUgroupIds($repository->getId(), Git::PERM_READ);
     foreach ($ugroup_ids as $ugroup_id) {
         if ($ugroup_id == ProjectUGroup::ANONYMOUS) {
             return true;
         }
     }
     return false;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:10,代码来源:CommandFactory.class.php


示例9: process

 public function process()
 {
     global $sys_allow_restricted_users;
     $parameters = $this->getParametersAsArray();
     $project = null;
     if (!empty($parameters[0])) {
         $project = $this->getProject($parameters[0]);
     } else {
         $this->error('Missing argument project id');
         return false;
     }
     $repositoryName = '';
     if (!empty($parameters[1])) {
         $repositoryName = $parameters[1];
     } else {
         $this->error('Missing argument repository name');
         return false;
     }
     $userId = 0;
     if (!empty($parameters[2])) {
         $userId = $parameters[2];
     } else {
         $this->error('Missing argument user id');
         return false;
     }
     try {
         $repository = new GitRepository();
         $repository->setBackend(Backend::instance('Git', 'GitBackend'));
         $repository->setDescription('-- Default description --');
         //default access is private when restricted users are allowed
         if ($sys_allow_restricted_users == 1) {
             $repository->setAccess(GitRepository::PRIVATE_ACCESS);
         } else {
             $repository->setAccess(GitRepository::PUBLIC_ACCESS);
         }
         $user = null;
         if (!empty($userId)) {
             $user = UserManager::instance()->getUserById($userId);
         }
         if (!empty($user)) {
             $repository->setCreator($user);
         }
         $repository->setProject($project);
         $repository->setName($repositoryName);
         $repository->create();
         $this->done();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitDriverException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitBackendException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:60,代码来源:SystemEvent_GIT_REPO_CREATE.class.php


示例10: deleteRepo

 private function deleteRepo(GitRepository $repository)
 {
     try {
         $repository->delete();
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
     $this->done();
     return true;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:11,代码来源:SystemEvent_GIT_REPO_DELETE.class.php


示例11: makeGerritProjectReadOnly

 private function makeGerritProjectReadOnly(GitRepository $repository, Git_RemoteServer_GerritServer $server, Project $project)
 {
     try {
         $this->driver_factory->getDriver($server)->makeGerritProjectReadOnly($server, $project->getUnixName() . '/' . $repository->getName());
     } catch (Exception $e) {
         $this->error($e->getMessage() . $e->getTraceAsString());
         return false;
     }
     $this->done();
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:SystemEvent_GIT_GERRIT_PROJECT_READONLY.class.php


示例12: areRegisteredUsersAllowedTo

 /** @return bool */
 public function areRegisteredUsersAllowedTo($permission_type, GitRepository $repository)
 {
     if ($permission_type == Git::SPECIAL_PERM_ADMIN) {
         return false;
     }
     foreach ($this->permissions_manager->getAuthorizedUgroups($repository->getId(), $permission_type) as $row) {
         if ($row['ugroup_id'] == ProjectUGroup::REGISTERED || $row['ugroup_id'] == ProjectUGroup::ANONYMOUS || $row['ugroup_id'] == ProjectUGroup::AUTHENTICATED) {
             return true;
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:UserFinder.class.php


示例13: _GivenAGitRepoWithNameAndNamespace

 protected function _GivenAGitRepoWithNameAndNamespace($name, $namespace)
 {
     $repository = new GitRepository();
     $repository->setName($name);
     $repository->setNamespace($namespace);
     $project = new MockProject();
     $project->setReturnValue('getUnixName', 'gpig');
     $project->setReturnValue('getId', 123);
     $repository->setProject($project);
     return $repository;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:Git_Backend_GitoliteTest.php


示例14: doValidate

 public function doValidate($validator, $values)
 {
     try {
         $git = new GitRepository(sprintf('git://github.com/%s/%s.git', $values['user'], $values['repository']), sfConfig::get('app_git_storage_path'), sfConfig::get('app_git_command'));
         $git->fetch();
         $this->gitRepositoryPath = $git->getPath();
     } catch (GitRepositoryException $e) {
         throw new sfValidatorError($validator, 'Problems pulling/updating the repository.');
     }
     return $values;
 }
开发者ID:pkdevbox,项目名称:mootools-forge,代码行数:11,代码来源:PluginAddStep4Form.class.php


示例15: _itCallsTheRealThing

 public function _itCallsTheRealThing()
 {
     $r = new GitRepository();
     $r->setName('dusse');
     $r->setNamespace('jean_claude');
     //$p = new Project(array('unix_group_name' => 'LesBronzes', 'group_id' => 50));
     $p = stub('Project')->getUnixName()->returns('LesBronzes');
     $r->setProject($p);
     $driver = new Git_Driver_Gerrit(new Git_Driver_Gerrit_RemoteSSHCommand(new BackendLogger()), new BackendLogger());
     $driver->createProject($r);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:Gerrit_manageProjectsTest.php


示例16: launchForRepository

 private function launchForRepository(GitRepository $repository)
 {
     $res = $this->dao->retrieveTriggersPathByRepository($repository->getId());
     if ($res && !$res->isError() && $res->rowCount() > 0) {
         foreach ($res as $row) {
             try {
                 $this->jenkins_client->setToken($row['token'])->launchJobBuild($row['job_url']);
             } catch (Exception $exception) {
                 $this->logger->error(__CLASS__ . '[' . $repository->getId() . '] ' . $exception->getMessage());
             }
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:13,代码来源:Launcher.class.php


示例17: deleteRepo

 private function deleteRepo(GitRepository $repository)
 {
     $path = $repository->getPath();
     try {
         $this->logger->debug("Deleting repository " . $path);
         $this->system_event_manager->queueGrokMirrorManifestRepoDelete($path);
         $repository->delete();
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
     $this->done();
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:SystemEvent_GIT_REPO_DELETE.class.php


示例18: sendMail

 /**
  * @return bool
  */
 private function sendMail(GitRepository $repository, MailBuilder $mail_builder, $oldrev, $newrev, $refname)
 {
     $mail_raw_output = array();
     exec('/usr/share/codendi/plugins/git/hooks/post-receive-email ' . escapeshellarg($oldrev) . ' ' . escapeshellarg($newrev) . ' ' . escapeshellarg($refname), $mail_raw_output);
     $subject = isset($mail_raw_output[0]) ? $mail_raw_output[0] : self::DEFAULT_MAIL_SUBJECT;
     $mail_enhancer = new MailEnhancer();
     $this->addAdditionalMailHeaders($mail_enhancer, $mail_raw_output);
     $body = $this->createMailBody($mail_raw_output);
     $access_link = $repository->getDiffLink($this->repository_url_manager, $newrev);
     $notification = new Notification($repository->getNotifiedMails(), $subject, '', $body, $access_link, 'Git');
     return $mail_builder->buildAndSendEmail($repository->getProject(), $notification, $mail_enhancer);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:15,代码来源:PostReceive.class.php


示例19: deleteGerritProject

 private function deleteGerritProject(GitRepository $repository, Git_RemoteServer_GerritServer $server, Project $project, $backend)
 {
     try {
         $this->driver_factory->getDriver($server)->deleteProject($server, $project->getUnixName() . '/' . $repository->getName());
         $backend->setGerritProjectAsDeleted($repository);
     } catch (Exception $e) {
         $this->error($e->getMessage() . $e->getTraceAsString());
         return false;
     }
     $this->done();
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:SystemEvent_GIT_GERRIT_PROJECT_DELETE.class.php


示例20: itAsksToDeleteTheRepositoryFromAllManifests

 public function itAsksToDeleteTheRepositoryFromAllManifests()
 {
     expect($this->generator)->removeRepositoryFromManifestFile('*', $this->repository->getPath())->count(2);
     expect($this->generator)->removeRepositoryFromManifestFile($this->singapour_mirror, $this->repository->getPath())->at(0);
     expect($this->generator)->removeRepositoryFromManifestFile($this->noida_mirror, $this->repository->getPath())->at(1);
     $this->manager->triggerDelete($this->repository->getPath());
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:ManifestManagerTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP GlobalConfig类代码示例发布时间:2022-05-23
下一篇:
PHP Git类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap