本文整理汇总了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);
}
示例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();
}
}
}
示例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());
}
示例4: getObjectDatabase
import org.eclipse.jgit.lib.ObjectDatabase; //导入依赖的package包/类
ObjectDatabase getObjectDatabase() {
if (objectDatabase == null) {
objectDatabase = repository.getObjectDatabase();
}
return objectDatabase;
}