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


PHP GitRepository类代码示例

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


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


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