本文整理汇总了PHP中GitRepository::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::setName方法的具体用法?PHP GitRepository::setName怎么用?PHP GitRepository::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::setName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: _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);
}
示例3: _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;
}
示例4: generateGitRepository
public function generateGitRepository()
{
echo "Create Git repo\n";
$repository_factory = new GitRepositoryFactory(new GitDao(), $this->project_manager);
$git_system_event_manager = new Git_SystemEventManager($this->system_event_manager, $repository_factory);
$manager = $this->getGitRepositoryManager($repository_factory, $git_system_event_manager);
$backend = $this->getGitBackendGitolite($git_system_event_manager);
$repository = new GitRepository();
$repository->setBackend($backend);
$repository->setDescription("Git repository");
$repository->setCreator($this->user_manager->getUserByUserName(self::TEST_USER_1_NAME));
$repository->setProject($this->project_manager->getProjectByUnixName(self::PROJECT_TEST_GIT_SHORTNAME));
$repository->setName('repo01');
$manager->create($repository, $backend, array());
return $this;
}
示例5: testAddMailingShowRev
public function testAddMailingShowRev()
{
$GLOBALS['sys_https_host'] = 'codendi.org';
$prj = new MockProject($this);
$prj->setReturnValue('getId', 1750);
$repo = new GitRepository();
$repo->setPath('prj/repo.git');
$repo->setName('repo');
$repo->setProject($prj);
$repo->setId(290);
$driver = new MockGitDriver($this);
$driver->expectOnce('setConfig', array('/var/lib/codendi/gitroot/prj/repo.git', 'hooks.showrev', "t=%s; git show --name-status --pretty='format:URL: https://codendi.org/plugins/git/index.php/1750/view/290/?p=repo.git&a=commitdiff&h=%%H%%nAuthor: %%an <%%ae>%%nDate: %%aD%%n%%n%%s%%n%%b' \$t"));
$backend = new GitBackendTestVersion($this);
$backend->setUp($this->url_manager);
$backend->setGitRootPath(Git_Backend_Interface::GIT_ROOT_PATH);
$backend->setReturnValue('getDriver', $driver);
$backend->setUpMailingHook($repo);
}
示例6: hydrateRepositoryObject
/**
* @deprecated Should use GitRepository::getInstanceFrom row instead.
* @param GitRepository $repository
* @param type $result
*/
public function hydrateRepositoryObject(GitRepository $repository, $result)
{
$repository->setName($result[self::REPOSITORY_NAME]);
$repository->setPath($result[self::REPOSITORY_PATH]);
$repository->setId($result[self::REPOSITORY_ID]);
$repository->setDescription($result[self::REPOSITORY_DESCRIPTION]);
$repository->setParentId($result[self::REPOSITORY_PARENT]);
$project = ProjectManager::instance()->getProject($result[self::FK_PROJECT_ID]);
$repository->setProject($project);
$repository->setCreationDate($result[self::REPOSITORY_CREATION_DATE]);
$user = UserManager::instance()->getUserById($result[self::REPOSITORY_CREATION_USER_ID]);
$repository->setCreator($user);
$repository->setIsInitialized($result[self::REPOSITORY_IS_INITIALIZED]);
$repository->setDeletionDate($result[self::REPOSITORY_DELETION_DATE]);
$repository->setAccess($result[self::REPOSITORY_ACCESS]);
$repository->setMailPrefix($result[self::REPOSITORY_MAIL_PREFIX]);
$repository->setBackendType($result[self::REPOSITORY_BACKEND_TYPE]);
$repository->setNamespace($result[self::REPOSITORY_NAMESPACE]);
$repository->setBackupPath($result[self::REPOSITORY_BACKUP_PATH]);
$repository->setScope($result[self::REPOSITORY_SCOPE]);
$repository->setRemoteServerId($result[self::REMOTE_SERVER_ID]);
$repository->setRemoteServerDisconnectDate($result[self::REMOTE_SERVER_DISCONNECT_DATE]);
$repository->setRemoteProjectDeletionDate($result[self::REMOTE_SERVER_DELETE_DATE]);
$repository->setRemoteServerMigrationStatus($result[self::REMOTE_SERVER_MIGRATION_STATUS]);
$repository->loadNotifiedMails();
/* Here just for reviewer test, will be replaced by real DB data in a future changeset*/
$result[self::ENABLE_ONLINE_EDIT] = false;
if ($result[self::ENABLE_ONLINE_EDIT] && GitConfig::instance()->isOnlineEditEnabled()) {
$repository->enableOnlineEdit();
}
}
示例7: _GivenARepositoryWithNameAndNamespace
private function _GivenARepositoryWithNameAndNamespace($name, $namespace)
{
$repo = new GitRepository();
$repo->setName($name);
$repo->setNamespace($namespace);
return $repo;
}
示例8: buildRepository
/**
* Returns a default-value-filled repository
* @return GitRepository
*/
public function buildRepository(Project $project, $repository_name, PFUser $creator, Git_Backend_Interface $backend, $description = GitRepository::DEFAULT_DESCRIPTION)
{
$repository = new GitRepository();
$repository->setBackend($backend);
$repository->setDescription($description);
$repository->setCreator($creator);
$repository->setProject($project);
$repository->setName($repository_name);
return $repository;
}
示例9: testGetMailHookConfig
public function testGetMailHookConfig()
{
$prj = new MockProject($this);
$prj->setReturnValue('getUnixName', 'project1');
$prj->setReturnValue('getId', 101);
// ShowRev
$repo = new GitRepository();
$repo->setId(5);
$repo->setProject($prj);
$repo->setName('test_default');
$this->assertIdentical(file_get_contents($this->_fixDir . '/gitolite-mail-config/mailhook-rev.txt'), $this->driver->fetchMailHookConfig($prj, $repo));
// ShowRev + Mail
$repo = new GitRepository();
$repo->setId(5);
$repo->setProject($prj);
$repo->setName('test_default');
$repo->setNotifiedMails(array('john.doe@enalean.com', 'mme.michue@enalean.com'));
$this->assertIdentical(file_get_contents($this->_fixDir . '/gitolite-mail-config/mailhook-rev-mail.txt'), $this->driver->fetchMailHookConfig($prj, $repo));
// ShowRev + Mailprefix
$repo = new GitRepository();
$repo->setId(5);
$repo->setProject($prj);
$repo->setName('test_default');
$repo->setNotifiedMails(array('john.doe@enalean.com', 'mme.michue@enalean.com'));
$repo->setMailPrefix('[KOIN] ');
$this->assertIdentical(file_get_contents($this->_fixDir . '/gitolite-mail-config/mailhook-rev-mail-prefix.txt'), $this->driver->fetchMailHookConfig($prj, $repo));
// ShowRev + Mailprefix
$repo = new GitRepository();
$repo->setId(5);
$repo->setProject($prj);
$repo->setName('test_default');
$repo->setNotifiedMails(array('john.doe@enalean.com', 'mme.michue@enalean.com'));
$repo->setMailPrefix('["\\_o<"] \\t');
$this->assertIdentical(file_get_contents($this->_fixDir . '/gitolite-mail-config/mailhook-rev-mail-prefix-quote.txt'), $this->driver->fetchMailHookConfig($prj, $repo));
}
示例10: hydrateRepositoryObject
public function hydrateRepositoryObject(GitRepository $repository, $result)
{
$repository->setName($result[self::REPOSITORY_NAME]);
$repository->setPath($result[self::REPOSITORY_PATH]);
$repository->setId($result[self::REPOSITORY_ID]);
$repository->setDescription($result[self::REPOSITORY_DESCRIPTION]);
$repository->setParentId($result[self::REPOSITORY_PARENT]);
$project = ProjectManager::instance()->getProject($result[self::FK_PROJECT_ID]);
$repository->setProject($project);
$repository->setCreationDate($result[self::REPOSITORY_CREATION_DATE]);
$user = UserManager::instance()->getUserById($result[self::REPOSITORY_CREATION_USER_ID]);
$repository->setCreator($user);
$repository->setIsInitialized($result[self::REPOSITORY_IS_INITIALIZED]);
$repository->setDeletionDate($result[self::REPOSITORY_DELETION_DATE]);
$repository->setAccess($result[self::REPOSITORY_ACCESS]);
$repository->setMailPrefix($result[self::REPOSITORY_MAIL_PREFIX]);
$repository->setBackendType($result[self::REPOSITORY_BACKEND_TYPE]);
$repository->setNamespace($result[self::REPOSITORY_NAMESPACE]);
$repository->setScope($result[self::REPOSITORY_SCOPE]);
$repository->loadNotifiedMails();
}
示例11: testSetUpRepositoryConfigWithRightRepoId
/**
* This is almost the same test than testAddMailingShowRev but
* through the higher level setUpRepository.
* What we want to be sure it that the right repository id is set.
*/
public function testSetUpRepositoryConfigWithRightRepoId()
{
$GLOBALS['sys_https_host'] = 'codendi.org';
$prj = new MockProject($this);
$prj->setReturnValue('getId', 1750);
// Use real git object because we need to store values (id)
$repo = new GitRepository();
$repo->setPath('prj/repo.git');
$repo->setName('repo');
$repo->setProject($prj);
$repo->setId(290);
$dao = new MockGitDao($this);
$dao->expectOnce('save');
$dao->setReturnValue('save', 290);
// The id we expect below
$driver = new MockGitDriver($this);
$driver->expectOnce('setConfig', array('/var/lib/codendi/gitroot/prj/repo.git', 'hooks.showrev', "t=%s; git show --name-status --pretty='format:URL: https://codendi.org/plugins/git/index.php/1750/view/290/?p=repo.git&a=commitdiff&h=%%H%%nAuthor: %%an <%%ae>%%nDate: %%aD%%n%%n%%s%%n%%b' \$t"));
$backend = new GitBackend4SetUp($this);
$backend->setUp($this->url_manager);
$backend->setGitRootPath(Git_Backend_Interface::GIT_ROOT_PATH);
$backend->setReturnValue('getDriver', $driver);
$backend->setReturnValue('getDao', $dao);
$backend->setUpRepository($repo);
}
示例12: createReference
public function createReference($projectId, $repositoryName)
{
// Uncomment the following line only for debug prupose if you ever need to
// create a gitshell repo (good luck, luke, may the force be with you).
//$this->createGitshellReference($projectId, $repositoryName);
$c = $this->getController();
$projectId = intval($projectId);
try {
$repository = new GitRepository();
$repository->setBackend(new Git_Backend_Gitolite(new Git_GitoliteDriver()));
$repository->setDescription('-- Default description --');
$repository->setCreator(UserManager::instance()->getCurrentUser());
$repository->setProject(ProjectManager::instance()->getProject($projectId));
$repository->setName($repositoryName);
$this->manager->create($repository);
} catch (Exception $exception) {
$c->addError($exception->getMessage());
}
$c->redirect('/plugins/git/?action=index&group_id=' . $projectId);
return;
}
示例13: createReference
public function createReference($projectId, $repositoryName)
{
$controller = $this->getController();
$projectId = intval($projectId);
try {
$creator = UserManager::instance()->getCurrentUser();
$repository = new GitRepository();
$repository->setBackend($this->backend_gitolite);
$repository->setDescription(GitRepository::DEFAULT_DESCRIPTION);
$repository->setCreator($creator);
$repository->setProject(ProjectManager::instance()->getProject($projectId));
$repository->setName($repositoryName);
$this->manager->create($repository, $this->backend_gitolite);
$this->history_dao->groupAddHistory("git_repo_create", $repositoryName, $projectId);
$this->redirectToRepo($repository);
} catch (Exception $exception) {
$controller->addError($exception->getMessage());
}
$controller->redirect('/plugins/git/?action=index&group_id=' . $projectId);
return;
}