org.eclipse.jgit.lib.ObjectDatabase的实例源码

项目:github-bucket    文件WorkerTest.java   
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);
}
项目:incubator-netbeans    文件CheckoutRevisionCommand.java   
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,builder);
        builder.commit();
    } catch (IOException ex) {
        throw new GitException(ex);
    } finally {
        walk.release();
        if (od != null) {
            od.close();
        }
    }
}
项目:incubator-netbeans    文件Utils.java   
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());
}
项目:GitDirstat    文件GitRepository.java   
ObjectDatabase getobjectDatabase() {
    if (objectDatabase == null) {
        objectDatabase = repository.getobjectDatabase();
    }
    return objectDatabase;
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...