本文整理汇总了Java中org.eclipse.jgit.util.io.NullOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java NullOutputStream类的具体用法?Java NullOutputStream怎么用?Java NullOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NullOutputStream类属于org.eclipse.jgit.util.io包,在下文中一共展示了NullOutputStream类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fillLastModifiedCommits
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
private void fillLastModifiedCommits(ObjectId start, String basePath) throws IOException, GitAPIException {
Map<String, ObjectId> objects = lastModifiedCommits.get(start);
if (objects == null) {
objects = new TreeMap<>();
}
DiffFormatter diffFmt = new DiffFormatter(NullOutputStream.INSTANCE);
diffFmt.setRepository(getGitRepository());
LogCommand log = new Git(getGitRepository()).log();
if (!basePath.isEmpty()) {
log.addPath(basePath);
}
for(RevCommit c: log.call()) {
final RevTree a = c.getParentCount() > 0 ? c.getParent(0).getTree() : null;
final RevTree b = c.getTree();
for(DiffEntry diff: diffFmt.scan(a, b)) {
objects.put(diff.getNewPath(), c.getId());
}
}
lastModifiedCommits.put(start, objects);
}
开发者ID:naver,项目名称:svngit,代码行数:22,代码来源:GitFS.java
示例2: blockingPreviewDiff
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
private Map<String, Change<?>> blockingPreviewDiff(Revision baseRevision, Iterable<Change<?>> changes) {
requireNonNull(baseRevision, "baseRevision");
requireNonNull(changes, "changes");
baseRevision = blockingNormalize(baseRevision);
try (ObjectReader reader = jGitRepository.newObjectReader();
RevWalk revWalk = new RevWalk(reader);
DiffFormatter diffFormatter = new DiffFormatter(NullOutputStream.INSTANCE)) {
final ObjectId baseTreeId = toTreeId(revWalk, baseRevision);
final DirCache dirCache = DirCache.newInCore();
final int numEdits = applyChanges(baseRevision, baseTreeId, dirCache, changes);
if (numEdits == 0) {
return Collections.emptyMap();
}
CanonicalTreeParser p = new CanonicalTreeParser();
p.reset(reader, baseTreeId);
diffFormatter.setRepository(jGitRepository);
List<DiffEntry> result = diffFormatter.scan(p, new DirCacheIterator(dirCache));
return toChangeMap(result);
} catch (IOException e) {
throw new StorageException("failed to perform a dry-run diff", e);
}
}
开发者ID:line,项目名称:centraldogma,代码行数:26,代码来源:GitRepository.java
示例3: reindex
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
private <K, V, I extends Index<K, V>> boolean reindex(IndexDefinition<K, V, I> def)
throws IOException {
I index = def.getIndexCollection().getSearchIndex();
checkNotNull(index, "no active search index configured for %s", def.getName());
index.markReady(false);
index.deleteAll();
SiteIndexer<K, V, I> siteIndexer = def.getSiteIndexer();
siteIndexer.setProgressOut(System.err);
siteIndexer.setVerboseOut(verbose ? System.out : NullOutputStream.INSTANCE);
SiteIndexer.Result result = siteIndexer.indexAll(index);
int n = result.doneCount() + result.failedCount();
double t = result.elapsed(TimeUnit.MILLISECONDS) / 1000d;
System.out.format(
"Reindexed %d documents in %s index in %.01fs (%.01f/s)\n", n, def.getName(), t, n / t);
if (result.success()) {
index.markReady(true);
}
return result.success();
}
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:Reindex.java
示例4: compareTrees
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
/**
* Compares the old tree and the new tree to get the list of the affected files.
*/
private List<DiffEntry> compareTrees(ObjectId prevTreeId, ObjectId nextTreeId, TreeFilter filter) {
try (DiffFormatter diffFormatter = new DiffFormatter(NullOutputStream.INSTANCE)) {
diffFormatter.setRepository(jGitRepository);
diffFormatter.setPathFilter(filter);
return diffFormatter.scan(prevTreeId, nextTreeId);
} catch (IOException e) {
throw new StorageException("failed to compare two trees: " + prevTreeId + " vs. " + nextTreeId, e);
}
}
开发者ID:line,项目名称:centraldogma,代码行数:14,代码来源:GitRepository.java
示例5: diff
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
public static List<DiffEntry> diff(Repository repository, AnyObjectId oldRevId, AnyObjectId newRevId) {
List<DiffEntry> diffs = new ArrayList<>();
try ( DiffFormatter diffFormatter = new DiffFormatter(NullOutputStream.INSTANCE);
RevWalk revWalk = new RevWalk(repository);
ObjectReader reader = repository.newObjectReader();) {
diffFormatter.setRepository(repository);
diffFormatter.setDetectRenames(true);
diffFormatter.setDiffComparator(RawTextComparator.DEFAULT);
CanonicalTreeParser oldTreeParser = new CanonicalTreeParser();
if (!oldRevId.equals(ObjectId.zeroId()))
oldTreeParser.reset(reader, revWalk.parseCommit(oldRevId).getTree());
CanonicalTreeParser newTreeParser = new CanonicalTreeParser();
if (!newRevId.equals(ObjectId.zeroId()))
newTreeParser.reset(reader, revWalk.parseCommit(newRevId).getTree());
for (DiffEntry entry: diffFormatter.scan(oldTreeParser, newTreeParser)) {
if (!Objects.equal(entry.getOldPath(), entry.getNewPath())
|| !Objects.equal(entry.getOldMode(), entry.getNewMode())
|| entry.getOldId()==null || !entry.getOldId().isComplete()
|| entry.getNewId()== null || !entry.getNewId().isComplete()
|| !entry.getOldId().equals(entry.getNewId())) {
diffs.add(entry);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return diffs;
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:32,代码来源:GitUtils.java
示例6: apply
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
@Override
public Response.Accepted apply(ProjectResource resource, ProjectInput input) {
Project.NameKey project = resource.getNameKey();
Task mpt =
new MultiProgressMonitor(ByteStreams.nullOutputStream(), "Reindexing project")
.beginSubTask("", MultiProgressMonitor.UNKNOWN);
AllChangesIndexer allChangesIndexer = allChangesIndexerProvider.get();
allChangesIndexer.setVerboseOut(NullOutputStream.INSTANCE);
// The REST call is just a trigger for async reindexing, so it is safe to ignore the future's
// return value.
@SuppressWarnings("unused")
Future<Void> ignored =
executor.submit(allChangesIndexer.reindexProject(indexer, project, mpt, mpt));
return Response.accepted("Project " + project + " submitted for reindexing");
}
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:Index.java
示例7: getCommitDiffFiles
import org.eclipse.jgit.util.io.NullOutputStream; //导入依赖的package包/类
private List<DiffCommitFile> getCommitDiffFiles(RevCommit revCommit, String pattern)
throws IOException {
List<DiffEntry> diffs;
TreeFilter filter = null;
if (!isNullOrEmpty(pattern)) {
filter =
AndTreeFilter.create(
PathFilterGroup.createFromStrings(Collections.singleton(pattern)),
TreeFilter.ANY_DIFF);
}
List<DiffCommitFile> commitFilesList = new ArrayList<>();
try (TreeWalk tw = new TreeWalk(repository)) {
tw.setRecursive(true);
// get the current commit parent in order to compare it with the current commit
// and to get the list of DiffEntry.
if (revCommit.getParentCount() > 0) {
RevCommit parent = parseCommit(revCommit.getParent(0));
tw.reset(parent.getTree(), revCommit.getTree());
if (filter != null) {
tw.setFilter(filter);
} else {
tw.setFilter(TreeFilter.ANY_DIFF);
}
diffs = DiffEntry.scan(tw);
} else {
// If the current commit has no parents (which means it is the initial commit),
// then create an empty tree and compare it to the current commit to get the
// list of DiffEntry.
try (RevWalk rw = new RevWalk(repository);
DiffFormatter diffFormat = new DiffFormatter(NullOutputStream.INSTANCE)) {
diffFormat.setRepository(repository);
if (filter != null) {
diffFormat.setPathFilter(filter);
}
diffs =
diffFormat.scan(
new EmptyTreeIterator(),
new CanonicalTreeParser(null, rw.getObjectReader(), revCommit.getTree()));
}
}
}
if (diffs != null) {
commitFilesList.addAll(
diffs
.stream()
.map(
diff ->
newDto(DiffCommitFile.class)
.withOldPath(diff.getOldPath())
.withNewPath(diff.getNewPath())
.withChangeType(diff.getChangeType().name()))
.collect(toList()));
}
return commitFilesList;
}
开发者ID:eclipse,项目名称:che,代码行数:56,代码来源:JGitConnection.java
注:本文中的org.eclipse.jgit.util.io.NullOutputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论