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


Java TreeEntry类代码示例

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


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

示例1: createTree

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的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: createTree

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的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

示例3: commitFile

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
public void commitFile(String prefixPath,String rootPath,String path) {		
	try {
		ArrayList<TreeEntry> tree2 = new ArrayList<TreeEntry>();
		tree2.add(PublishHelper.createTree(prefixPath, rootPath, path, service, id));
		commitTree(tree2);
	} catch (IOException e1) {
		e1.printStackTrace();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:12,代码来源:PublishHelper.java

示例4: commitFileFromString

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
public void commitFileFromString(String prefixPath,String name,String contents) {		
	try {
		ArrayList<TreeEntry> tree2 = new ArrayList<TreeEntry>();
		tree2.add(PublishHelper.createTreeFromString(prefixPath, name, contents, service, id));
		commitTree(tree2);
	} catch (IOException e1) {
		e1.printStackTrace();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:12,代码来源:PublishHelper.java

示例5: createTree

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
public static TreeEntry createTree(String prefix, String out, String path, DataService serv, RepositoryId id)
		throws Exception {
	TreeEntry entry = new TreeEntry();
	entry.setPath(prefix + path);
	entry.setType(TreeEntry.TYPE_BLOB);
	entry.setMode(TreeEntry.MODE_BLOB);
	entry.setSha(createBlob(serv, id, out, path));
	return entry;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:10,代码来源:PublishHelper.java

示例6: createTreeFromString

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
public static TreeEntry createTreeFromString(String prefix, String name, String content, DataService serv, RepositoryId id)
		throws Exception {
	TreeEntry entry = new TreeEntry();
	entry.setPath(prefix + name);
	entry.setType(TreeEntry.TYPE_BLOB);
	entry.setMode(TreeEntry.MODE_BLOB);
	Blob blob = new Blob().setEncoding(Blob.ENCODING_UTF8);
	blob.setContent(content);
	entry.setSha(serv.createBlob(id, blob));
	return entry;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:12,代码来源:PublishHelper.java

示例7: addFile

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
private void addFile(TreeEntry entry, String[] pathSegments, int index) {
    if (index == pathSegments.length - 1) {
        Entry file = new Entry(entry, this);
        files.put(file.name, file);
    } else {
        Folder folder = folders.get(pathSegments[index]);
        if (folder != null)
            folder.addFile(entry, pathSegments, index + 1);
    }
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:11,代码来源:FullTree.java

示例8: FullTree

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的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

示例9: createEntries

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
private List<TreeEntry> createEntries(List<TreeEntry> entries, final String prefix, final String[] paths, 
		final DataService service, final RepositoryId repository, final File outputDirectory) throws GitHubException{
	for (String path : paths) {
		TreeEntry entry = createEntry(prefix, path, service, repository, outputDirectory);
		entries.add(entry);
	}
	return entries;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:9,代码来源:GitHub.java

示例10: createEntry

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
private TreeEntry createEntry(String prefix, String path, DataService service, RepositoryId repository, File outputDirectory) throws GitHubException {
	TreeEntry entry = new TreeEntry();
	entry.setPath(prefix + path);
	entry.setType(TYPE_BLOB);
	entry.setMode(MODE_BLOB);
	if(!dryRun){
		entry.setSha(createBlob(service, repository, outputDirectory, path));
		log.info("" + path + " -> " + entry.getSha());
	}
	return entry;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:12,代码来源:GitHub.java

示例11: commitFileToRepository

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的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

示例12: Entry

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
private Entry(TreeEntry entry, Folder parent) {
    this.entry = entry;
    this.parent = parent;
    this.name = CommitUtils.getName(entry.getPath());
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:6,代码来源:FullTree.java

示例13: Folder

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
private Folder(TreeEntry entry, Folder parent) {
    super(entry, parent);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:4,代码来源:FullTree.java

示例14: ContentItem

import org.eclipse.egit.github.core.TreeEntry; //导入依赖的package包/类
public ContentItem(TreeEntry entry) {
    super();

    this.entry = entry;
}
 
开发者ID:mthli,项目名称:Bitocle,代码行数:6,代码来源:ContentItem.java

示例15: getEntry

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


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