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

Java Tree类代码示例

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

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



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

示例1: createTree

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
private Tree createTree(DataService service, RepositoryId repository, Reference ref, List<TreeEntry> entries) throws GitHubException {
	try {
		int size = entries.size();
		log.info(String.format("Creating tree with %s blob entries", size));

		String baseTree = null;
		if (merge && ref != null) {
			Tree currentTree = service.getCommit(repository, ref.getObject().getSha()).getTree();
			if (currentTree != null){
				baseTree = currentTree.getSha();
			}
			log.info(MessageFormat.format("Merging with tree {0}", baseTree));
		}
		
		return service.createTree(repository, entries, baseTree);
	} catch (IOException e) {
		throw new GitHubException("Error creating tree: " + e.getMessage(), e);
	}
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:20,代码来源:GitHub.java


示例2: getTree

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
/**
 * Get tree with given SHA-1
 *
 * @param repository
 * @param sha
 * @param recursive
 * @return tree
 * @throws IOException
 */
public Tree getTree(IRepositoryIdProvider repository, String sha,
		boolean recursive) throws IOException {
	final String id = getId(repository);
	if (sha == null)
		throw new IllegalArgumentException("SHA-1 cannot be null"); //$NON-NLS-1$
	if (sha.length() == 0)
		throw new IllegalArgumentException("SHA-1 cannot be empty"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder();
	uri.append(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_GIT);
	uri.append(SEGMENT_TREES);
	uri.append('/').append(sha);
	GitHubRequest request = createRequest();
	request.setType(Tree.class);
	request.setUri(uri);
	if (recursive)
		request.setParams(Collections.singletonMap("recursive", "1")); //$NON-NLS-1$ //$NON-NLS-2$
	return (Tree) client.get(request).getBody();
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:31,代码来源:DataService.java


示例3: createTree

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
/**
 * Create tree
 *
 * @param repository
 * @param entries
 * @param baseTree
 * @return created tree
 * @throws IOException
 */
public Tree createTree(IRepositoryIdProvider repository,
		Collection<TreeEntry> entries, String baseTree) throws IOException {
	final String id = getId(repository);

	StringBuilder uri = new StringBuilder();
	uri.append(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_GIT);
	uri.append(SEGMENT_TREES);
	GitHubRequest request = createRequest();
	request.setType(Tree.class);
	request.setUri(uri);
	Map<String, Object> params = new HashMap<String, Object>();
	if (entries != null)
		params.put("tree", entries.toArray()); //$NON-NLS-1$
	if (baseTree != null)
		params.put("base_tree", baseTree); //$NON-NLS-1$
	return client.post(uri.toString(), params, Tree.class);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:29,代码来源:DataService.java


示例4: run

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
@Override
protected FullTree run(Account account) throws Exception {
    Reference ref = reference;
    String branch = RefUtils.getPath(ref);
    if (branch == null) {
        branch = repository.getMasterBranch();
        if (TextUtils.isEmpty(branch)) {
            branch = repoService.getRepository(repository)
                    .getMasterBranch();
            if (TextUtils.isEmpty(branch))
                throw new IOException(
                        "Repository does not have master branch");
        }
        branch = "heads/" + branch;
    }

    if (!isValidRef(ref)) {
        ref = dataService.getReference(repository, branch);
        if (!isValidRef(ref))
            throw new IOException(
                    "Reference does not have associated commit SHA-1");
    }

    Commit commit = dataService.getCommit(repository, ref.getObject()
            .getSha());
    if (commit == null || commit.getTree() == null
            || TextUtils.isEmpty(commit.getTree().getSha()))
        throw new IOException("Commit does not have associated tree SHA-1");

    Tree tree = dataService.getTree(repository, commit.getTree().getSha(),
            true);
    return new FullTree(tree, ref);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:34,代码来源:RefreshTreeTask.java


示例5: FullTree

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
/**
 * Create tree with branch
 *
 * @param tree
 * @param reference
 */
public FullTree(final Tree tree, final Reference reference) {
    this.tree = tree;
    this.reference = reference;
    this.branch = RefUtils.getName(reference);

    root = new Folder();
    List<TreeEntry> entries = tree.getTree();
    if (entries != null && !entries.isEmpty())
        for (TreeEntry entry : entries)
            root.add(entry);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:FullTree.java


示例6: createCommit

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
/**
 * Create commit in given repository
 *
 * @param repository
 * @param commit
 * @return created commit
 * @throws IOException
 */
public Commit createCommit(IRepositoryIdProvider repository, Commit commit)
		throws IOException {
	final String id = getId(repository);
	if (commit == null)
		throw new IllegalArgumentException("Commit cannot be null"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder();
	uri.append(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_GIT);
	uri.append(SEGMENT_COMMITS);
	Map<String, Object> params = new HashMap<String, Object>();
	params.put("author", commit.getAuthor()); //$NON-NLS-1$
	params.put("committer", commit.getCommitter()); //$NON-NLS-1$
	params.put("message", commit.getMessage()); //$NON-NLS-1$
	List<Commit> parents = commit.getParents();
	if (parents != null && parents.size() > 0) {
		List<String> parentIds = new ArrayList<String>();
		for (Commit parent : parents)
			parentIds.add(parent.getSha());
		params.put("parents", parentIds); //$NON-NLS-1$
	}
	Tree tree = commit.getTree();
	if (tree != null)
		params.put("tree", tree.getSha()); //$NON-NLS-1$
	return client.post(uri.toString(), params, Commit.class);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:36,代码来源:DataService.java


示例7: commitFileToRepository

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
private void commitFileToRepository(File commitDirectory, Repository repo,String refString,String accessToken) throws Exception
{
	DataService dService=new DataService();
	dService.getClient().setOAuth2Token(accessToken);
	Reference ref=dService.getReference(repo, refString);
	String lastCommitSHA=ref.getObject().getSha();
	List<TreeEntry> treeArray=new ArrayList<TreeEntry>();
	for(File f:commitDirectory.listFiles())
		buildTreeRecusive(f,repo,dService,treeArray);
	Tree tree=dService.createTree(repo, treeArray);
	logger.info("Try to make up commit");
	Commit parentCommit=new Commit();
	parentCommit.setSha(lastCommitSHA);
	List<Commit> parentCommitList=new ArrayList<Commit>();
	parentCommitList.add(parentCommit);
	Commit commit=new Commit();
	commit.setTree(tree);
	commit.setParents(parentCommitList);
	commit.setMessage(generateCommitMessage());
	commit=dService.createCommit(repo, commit);
	logger.info("Try to edit reference");
	ref.setRef(refString);
	TypedResource res=new TypedResource();
	res.setSha(commit.getSha());
	res.setType(TypedResource.TYPE_COMMIT);
	res.setUrl(commit.getUrl());
	ref.setObject(res);
	dService.editReference(repo, ref);
}
 
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:30,代码来源:PageManager.java


示例8: getTree

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
public Tree getTree(Repository repository, String sha) throws IOException {
    return dataService.getTree(repository, sha, true);
}
 
开发者ID:drifted-in,项目名称:txgh,代码行数:4,代码来源:GitHubApi.java


示例9: getRoot

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
public Tree getRoot() {
    return root;
}
 
开发者ID:mthli,项目名称:Bitocle,代码行数:4,代码来源:MainFragment.java


示例10: setRoot

import org.eclipse.egit.github.core.Tree; //导入依赖的package包/类
public void setRoot(Tree root) {
    this.root = root;
}
 
开发者ID:mthli,项目名称:Bitocle,代码行数:4,代码来源:MainFragment.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java TransportOutDescription类代码示例发布时间:2022-05-22
下一篇:
Java GenericRecommenderIRStatsEvaluator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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