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


Java Repository.setName方法代码示例

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


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

示例1: createTestRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
private static void createTestRepository(User user) throws Exception {
	GitHubClient client = createClient(user.getGitHubAccessToken());
	RepositoryService repository = new RepositoryService(client);

	Repository toCreate = new Repository();
	toCreate.setName("cla-test");

	RestTemplate rest = new RestTemplate();
	try {
		rest.delete("https://api.github.com/repos/{owner}/{repo}?access_token={token}", user.getGitHubUsername(), toCreate.getName(), user.getGitHubAccessToken());
	}catch(Throwable t) {
		t.printStackTrace();
	}

	repository.createRepository(toCreate);

	Thread.sleep(TimeUnit.SECONDS.toMillis(1L));

	// we need content to allow forking
	Map<String,String> content = new HashMap<>();
	content.put("message", "Initial");
	content.put("content", "bXkgbmV3IGZpbGUgY29udGVudHM=");
	rest.put("https://api.github.com/repos/{owner}/{repo}/contents/README.adoc?access_token={token}", content, user.getGitHubUsername(), toCreate.getName(), user.getGitHubAccessToken());
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:25,代码来源:SmokeTests.java

示例2: createRepoForOrg

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Create a repository for a given organization with a description
 *
 * @param org
 * @param repoName
 * @param description
 * @return RepoItem bean/json object
 * @throws KaramelException
 */
public synchronized static RepoItem createRepoForOrg(String org, String repoName, String description) throws
    KaramelException {
  try {
    OrganizationService os = new OrganizationService(client);
    RepositoryService rs = new RepositoryService(client);
    Repository r = new Repository();
    r.setName(repoName);
    r.setOwner(os.getOrganization(org));
    r.setDescription(description);
    rs.createRepository(org, r);
    cloneRepo(org, repoName);
    cachedRepos.remove(org);
    return new RepoItem(repoName, description, r.getSshUrl());
  } catch (IOException ex) {
    throw new KaramelException("Problem creating the repository " + repoName + " for organization " + org
        + " : " + ex.getMessage());
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:28,代码来源:GithubApi.java

示例3: createRepoForUser

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Create a repository in a given github user's local account.
 *
 * @param repoName
 * @param description
 * @throws KaramelException
 */
public synchronized static void createRepoForUser(String repoName, String description) throws KaramelException {
  try {
    UserService us = new UserService(client);
    RepositoryService rs = new RepositoryService(client);
    Repository r = new Repository();
    r.setName(repoName);
    r.setOwner(us.getUser());
    r.setDescription(description);
    rs.createRepository(r);
    cloneRepo(getUser(), repoName);
    cachedRepos.remove(GithubApi.getUser());
  } catch (IOException ex) {
    throw new KaramelException("Problem creating " + repoName + " for user " + ex.getMessage());
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:23,代码来源:GithubApi.java

示例4: createGitRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Creates a repository on GitHub and in a local temporary directory. This is a one time operation as
 * once it is created on GitHub and locally it cannot be recreated.
 */
public File createGitRepository(String repositoryName) throws IOException {
    RepositoryService service = new RepositoryService();
    service.getClient().setOAuth2Token(oAuthToken);
    Repository repository = new Repository();
    repository.setName(repositoryName);
    repository = service.createRepository(repository);
    repositoryLocation = repository.getHtmlUrl();

    CloneCommand cloneCommand = Git.cloneRepository()
            .setURI(repository.getCloneUrl())
            .setDirectory(localGitDirectory);
    addAuth(cloneCommand);
    try {
        localRepository = cloneCommand.call();
    } catch (GitAPIException e) {
        throw new IOException("Error cloning to local file system", e);
    }
    return localGitDirectory;
}
 
开发者ID:WASdev,项目名称:tool.accelerate.core,代码行数:24,代码来源:GitHubConnector.java

示例5: loadFrom

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
@Override
public Repository loadFrom(Cursor cursor) {
    Repository repo = new Repository();
    repo.setId(cursor.getLong(0));
    repo.setName(cursor.getString(1));

    User owner = new User();
    owner.setId(cursor.getInt(2));
    owner.setLogin(cursor.getString(3));
    owner.setAvatarUrl(cursor.getString(4));
    repo.setOwner(owner);

    repo.setPrivate(cursor.getInt(5) == 1);
    repo.setFork(cursor.getInt(6) == 1);
    repo.setDescription(cursor.getString(7));
    repo.setForks(cursor.getInt(8));
    repo.setWatchers(cursor.getInt(9));
    repo.setLanguage(cursor.getString(10));
    repo.setHasIssues(cursor.getInt(11) == 1);
    repo.setMirrorUrl(cursor.getString(12));

    return repo;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:24,代码来源:OrganizationRepositories.java

示例6: getRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Get {@link Repository} from {@link EventRepository} and actor
 *
 * @param repo
 * @param actor
 * @param org
 * @return possibly null repository
 */
public static Repository getRepository(final EventRepository repo,
        User actor, User org) {
    if (repo == null)
        return null;

    String id = repo.getName();
    int slash = id.indexOf('/');
    if (slash == -1 || slash + 1 >= id.length())
        return null;

    Repository full = new Repository();
    full.setId(repo.getId());
    full.setName(id.substring(slash + 1));
    String login = id.substring(0, slash);
    // Use actor if it matches login parsed from repository id
    if (actor != null && login.equals(actor.getLogin()))
        full.setOwner(actor);
    else if (org != null && login.equals(org.getLogin()))
        full.setOwner(org);
    else
        full.setOwner(new User().setLogin(id.substring(0, slash)));
    return full;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:32,代码来源:RepositoryEventMatcher.java

示例7: getRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Attempt to parse a {@link Repository} from the given {@link Uri}
 *
 * @param uri
 * @return {@link Repository} or null if unparseable
 */
public static Repository getRepository(Uri uri) {
    List<String> segments = uri.getPathSegments();
    if (segments == null)
        return null;
    if (segments.size() != 2)
        return null;

    String repoOwner = segments.get(0);
    if (!RepositoryUtils.isValidOwner(repoOwner))
        return null;

    String repoName = segments.get(1);
    if (TextUtils.isEmpty(repoName))
        return null;

    Repository repository = new Repository();
    repository.setName(repoName);
    repository.setOwner(new User().setLogin(repoOwner));
    return repository;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:27,代码来源:RepositoryUriMatcher.java

示例8: createRepositoryForUserOrOrg

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
private Repository createRepositoryForUserOrOrg(final String owner, final String repoName, final GitHubClient gitHubClient, final RepositoryService repositoryService)
        throws IOException
{
    Repository repository = new Repository();
    repository.setName(repoName);

    if (gitHubClient.getUser().equals(owner))
    {
        return repositoryService.createRepository(repository);
    }
    else
    {
        return repositoryService.createRepository(owner, repository);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:16,代码来源:GitHubTestSupport.java

示例9: createGithubRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
public void createGithubRepository(String repositoryName)
{
    Repository repository = new Repository();
    repository.setName(repositoryName);
    try
    {
        getRepositoryService().createRepository(repository);
    }
    catch (IOException e)
    {
        // repository could not be created
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:14,代码来源:GithubRepositoriesRemoteRestpoint.java

示例10: getCommit

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Attempt to parse a {@link CommitMatch} from the given {@link Uri}
 *
 * @param uri
 * @return {@link CommitMatch} or null if unparseable
 */
public static CommitMatch getCommit(Uri uri) {
    List<String> segments = uri.getPathSegments();
    if (segments == null)
        return null;
    if (segments.size() != 4)
        return null;
    if (!"commit".equals(segments.get(2)))
        return null;

    String repoOwner = segments.get(0);
    if (!RepositoryUtils.isValidOwner(repoOwner))
        return null;

    String repoName = segments.get(1);
    if (TextUtils.isEmpty(repoName))
        return null;

    String commit = segments.get(3);
    if (!CommitUtils.isValidCommit(commit))
        return null;

    Repository repository = new Repository();
    repository.setName(repoName);
    repository.setOwner(new User().setLogin(repoOwner));
    return new CommitMatch(repository, commit);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:33,代码来源:CommitUriMatcher.java

示例11: getCommit

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Get commit match from URL
 *
 * @param url
 * @return commit match or null if the given URL wasn't a match
 */
public CommitMatch getCommit(final String url) {
    if (!isMatch(url, matcher))
        return null;

    String owner = matcher.group(1);
    String name = matcher.group(2);
    String sha = matcher.group(3);
    Repository repo = new Repository();
    repo.setName(name);
    repo.setOwner(new User().setLogin(owner));
    return new CommitMatch(repo, sha);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:19,代码来源:CommitUrlMatcher.java

示例12: getIssue

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
/**
 * Parse a {@link RepositoryIssue} from a non-null {@link Uri}
 *
 * @param uri
 * @return {@link RepositoryIssue} or null if none found in given
 *         {@link Uri}
 */
public static RepositoryIssue getIssue(Uri uri) {
    List<String> segments = uri.getPathSegments();
    if (segments == null)
        return null;
    if (segments.size() < 4)
        return null;
    if (!"issues".equals(segments.get(2))
            && !"pull".equals(segments.get(2)))
        return null;

    String repoOwner = segments.get(0);
    if (TextUtils.isEmpty(repoOwner))
        return null;

    String repoName = segments.get(1);
    if (TextUtils.isEmpty(repoName))
        return null;

    String number = segments.get(3);
    if (TextUtils.isEmpty(number))
        return null;

    int issueNumber;
    try {
        issueNumber = Integer.parseInt(number);
    } catch (NumberFormatException nfe) {
        return null;
    }
    if (issueNumber < 1)
        return null;

    Repository repo = new Repository();
    repo.setName(repoName);
    repo.setOwner(new User().setLogin(repoOwner));
    RepositoryIssue issue = new RepositoryIssue();
    issue.setRepository(repo);
    issue.setNumber(issueNumber);
    return issue;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:47,代码来源:IssueUriMatcher.java

示例13: mockPR

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
private PullRequest mockPR() {
    final PullRequest pr = new PullRequest();
    final PullRequestMarker head = new PullRequestMarker();
    final User owner = new User();
    owner.setLogin("user");
    final Repository repo = new Repository();
    repo.setName("repo");
    repo.setOwner(owner);
    head.setRepo(repo);
    pr.setHead(head);
    head.setRef("feature/my-branch");
    pr.setNumber(1);
    return pr;
}
 
开发者ID:caarlos0-graveyard,项目名称:github-integrator,代码行数:15,代码来源:MainIntegratorTest.java

示例14: getRepository

import org.eclipse.egit.github.core.Repository; //导入方法依赖的package包/类
@Override
public Repository getRepository(final String owner, final String name) throws IOException {
    Repository repository = new Repository();
    repository.setName(name);
    return repository;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:MockRepositoryService.java


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