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


Java ObjectDatabase类代码示例

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


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

示例1: WorkerTest

import org.eclipse.jgit.lib.ObjectDatabase; //导入依赖的package包/类
public WorkerTest() {
    URIish fetchUrl = new URIish();
    SyncableRepository pushRepository = mock(SyncableRepository.class);

    when(config.getFetchUrl()).thenReturn(fetchUrl);
    when(config.getPushRepository()).thenReturn(pushRepository);

    ObjectDatabase database = mock(ObjectDatabase.class);
    when(database.exists()).thenReturn(false);
    Repository repository = mock(Repository.class);
    when(repository.getObjectDatabase()).thenReturn(database);
    when(config.getWorkingFileRepository()).thenReturn(repository);

    uut = new Worker(config);
}
 
开发者ID:berlam,项目名称:github-bucket,代码行数:16,代码来源:WorkerTest.java

示例2: mergeConflicts

import org.eclipse.jgit.lib.ObjectDatabase; //导入依赖的package包/类
private void mergeConflicts (List<String> conflicts, DirCache cache) throws GitException {
    DirCacheBuilder builder = cache.builder();
    DirCacheBuildIterator dci = new DirCacheBuildIterator(builder);
    TreeWalk walk = new TreeWalk(getRepository());
    ObjectDatabase od = null;
    DiffAlgorithm.SupportedAlgorithm diffAlg = getRepository().getConfig().getEnum(
                    ConfigConstants.CONFIG_DIFF_SECTION, null,
                    ConfigConstants.CONFIG_KEY_ALGORITHM,
                    DiffAlgorithm.SupportedAlgorithm.HISTOGRAM);
    MergeAlgorithm merger = new MergeAlgorithm(DiffAlgorithm.getAlgorithm(diffAlg));
    try {
        od = getRepository().getObjectDatabase();
        walk.addTree(dci);
        walk.setFilter(PathFilterGroup.create(Utils.getPathFilters(conflicts)));
        String lastPath = null;
        DirCacheEntry[] entries = new DirCacheEntry[3];
        walk.setRecursive(true);
        while (walk.next()) {
            DirCacheEntry e = walk.getTree(0, DirCacheIterator.class).getDirCacheEntry();
            String path = e.getPathString();
            if (lastPath != null && !lastPath.equals(path)) {
                resolveEntries(merger, lastPath, entries, od, builder);
            }
            if (e.getStage() == 0) {
                DirCacheIterator c = walk.getTree(0, DirCacheIterator.class);
                builder.add(c.getDirCacheEntry());
            } else {
                entries[e.getStage() - 1] = e;
                lastPath = path;
            }
        }
        resolveEntries(merger, lastPath, entries, od, builder);
        builder.commit();
    } catch (IOException ex) {
        throw new GitException(ex);
    } finally {
        walk.release();
        if (od != null) {
            od.close();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:CheckoutRevisionCommand.java

示例3: getRawText

import org.eclipse.jgit.lib.ObjectDatabase; //导入依赖的package包/类
public static RawText getRawText (ObjectId id, ObjectDatabase db) throws IOException {
    if (id.equals(ObjectId.zeroId())) {
        return RawText.EMPTY_TEXT;
    }
    return new RawText(db.open(id, Constants.OBJ_BLOB).getCachedBytes());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:Utils.java

示例4: getObjectDatabase

import org.eclipse.jgit.lib.ObjectDatabase; //导入依赖的package包/类
ObjectDatabase getObjectDatabase() {
	if (objectDatabase == null) {
		objectDatabase = repository.getObjectDatabase();
	}
	return objectDatabase;
}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:7,代码来源:GitRepository.java


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