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


Java DisabledOutputStream类代码示例

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


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

示例1: getPaths

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private List<DiffEntry> getPaths(Repository repository, RevCommit rev)
		throws MissingObjectException, IncorrectObjectTypeException,
		IOException {
	RevCommit parent = null;
	List<DiffEntry> diffs = null;
	RevWalk rw = new RevWalk(repository);
	DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);

	df.setRepository(repository);
	df.setDiffComparator(RawTextComparator.DEFAULT);
	df.setDetectRenames(true);

	if (rev.getParentCount() > 0 && rev.getParent(0) != null) {
		parent = rw.parseCommit(rev.getParent(0).getId());
		diffs = df.scan(parent.getTree(), rev.getTree());
	} else {
		diffs = df.scan(new EmptyTreeIterator(), new CanonicalTreeParser(
				null, rw.getObjectReader(), rev.getTree()));
	}

	return diffs;
}
 
开发者ID:aserg-ufmg,项目名称:ModularityCheck,代码行数:23,代码来源:GITLogHandler.java

示例2: isInPath

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private boolean isInPath(Repository repository, RevWalk walk, RevCommit commit) throws IOException {
    if (commit.getParentCount() == 0) {
        RevTree tree = commit.getTree();
        try (TreeWalk treeWalk = new TreeWalk(repository)) {
            treeWalk.addTree(tree);
            treeWalk.setRecursive(true);
            treeWalk.setFilter(pathFilter);
            return treeWalk.next();
        }
    } else {
        DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
        df.setRepository(repository);
        df.setPathFilter(pathFilter);
        RevCommit parent = walk.parseCommit(commit.getParent(0).getId());
        List<DiffEntry> diffs = df.scan(parent.getTree(), commit.getTree());
        return !diffs.isEmpty();
    }
}
 
开发者ID:jakubplichta,项目名称:git-changelog-maven-plugin,代码行数:19,代码来源:RepositoryProcessor.java

示例3: listFilesChangedInCommit

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private HashSet<String> listFilesChangedInCommit(Repository repository, AnyObjectId beforeID, AnyObjectId afterID) throws MissingObjectException, IncorrectObjectTypeException, IOException
{
	log.info("calculating files changed in commit");
	HashSet<String> result = new HashSet<>();
	RevWalk rw = new RevWalk(repository);
	RevCommit commitBefore = rw.parseCommit(beforeID);
	RevCommit commitAfter = rw.parseCommit(afterID);
	DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
	df.setRepository(repository);
	df.setDiffComparator(RawTextComparator.DEFAULT);
	df.setDetectRenames(true);
	List<DiffEntry> diffs = df.scan(commitBefore.getTree(), commitAfter.getTree());
	for (DiffEntry diff : diffs)
	{
		result.add(diff.getNewPath());
	}
	log.debug("Files changed between commits commit: {} and {} - {}", beforeID.getName(), afterID, result);
	return result;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:20,代码来源:SyncServiceGIT.java

示例4: getAllHistories

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
@Override
public Map<String, List<Revision>> getAllHistories() throws StoreException {
    final TestMatrixDefinition testMatrixDefinition = getCurrentTestMatrix().getTestMatrixDefinition();
    if (testMatrixDefinition == null) {
        return Collections.emptyMap();
    }
    final Set<String> activeTests = testMatrixDefinition.getTests().keySet();

    final Repository repository = git.getRepository();
    try {
        final ObjectId head = repository.resolve(Constants.HEAD);
        final RevWalk revWalk = new RevWalk(repository);
        final DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
        df.setRepository(git.getRepository());
        df.setDiffComparator(RawTextComparator.DEFAULT);

        final HistoryParser historyParser = new HistoryParser(revWalk, df, getTestDefinitionsDirectory(), activeTests);
        return historyParser.parseFromHead(head);

    } catch (final IOException e) {
        throw new StoreException("Could not get history " + getGitCore().getRefName(), e);
    }
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:24,代码来源:GitProctor.java

示例5: checkLogEntry

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private static boolean checkLogEntry(RevCommit gitLog, SVNLogEntry entry, String svnPath, String gitPath, Pattern pFilter) throws Exception {
	if (gitLog.getFullMessage().contains(entry.getMessage())) {
		log.trace("same message for " + entry.getRevision());
		if (gitLog.getAuthorIdent().getName().equals(authors.get(entry.getAuthor()).getKey())) {
			log.trace("same author for " + entry.getRevision());
			Set<String> gitSet = new HashSet<>();
			try (DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE)) {
				df.setRepository(git.getRepository());
				df.setDiffComparator(RawTextComparator.DEFAULT);
				df.setDetectRenames(true);

				df.scan(gitLog.getParent(0).getTree(), gitLog.getTree()).forEach(d -> {
					String path = d.getNewPath();
					String prePath = path.startsWith(gitPath) ? gitPath : path.startsWith(svnPath) ? svnPath : null;
					if (prePath != null && pFilter.matcher(path).find()) {
						gitSet.add(path.substring(prePath.length()));
					}
				});
			}
			Set<String> svnSet = new HashSet<>();
			entry.getChangedPaths().keySet().forEach(path -> {
				int i = path.indexOf(svnPath);
				if (i != -1 && pFilter.matcher(path).find()) {
					svnSet.add(path.substring(i + svnPath.length()));
				}
			});
			
			boolean same = gitSet.equals(svnSet);
			log.debug("same content for " + entry.getRevision() + " ? " + same);
			return same;
		}
	}
	return false;
}
 
开发者ID:nicolas-albert,项目名称:sync-svn-git,代码行数:35,代码来源:SyncSvnGit.java

示例6: getDiffFormatter

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
/**
 * Get diff formatter.
 *
 * @param filePath optional filter for diff
 * @return diff formater
 */
private DiffFormatter getDiffFormatter(String filePath) {
    final DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
    df.setRepository(repository);
    df.setDiffComparator(RawTextComparator.DEFAULT);
    df.setDetectRenames(true);
    if (filePath != null) {
        df.setPathFilter(PathFilter.create(filePath));
    }
    return df;
}
 
开发者ID:iazarny,项目名称:gitember,代码行数:17,代码来源:GitRepositoryService.java

示例7: walkFilesInCommit

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private void walkFilesInCommit(
    Git gitClient,
    RevCommit commit,
    List<SourceCodeFileAnalyzerPlugin> analyzers,
    MetricsProcessor metricsProcessor)
    throws IOException {
  commit = CommitUtils.getCommit(gitClient.getRepository(), commit.getId());
  logger.info("starting analysis of commit {}", commit.getName());
  DiffFormatter diffFormatter = new DiffFormatter(DisabledOutputStream.INSTANCE);
  diffFormatter.setRepository(gitClient.getRepository());
  diffFormatter.setDiffComparator(RawTextComparator.DEFAULT);
  diffFormatter.setDetectRenames(true);

  ObjectId parentId = null;
  if (commit.getParentCount() > 0) {
    // TODO: support multiple parents
    parentId = commit.getParent(0).getId();
  }

  List<DiffEntry> diffs = diffFormatter.scan(parentId, commit);
  for (DiffEntry diff : diffs) {
    String filePath = diff.getPath(DiffEntry.Side.NEW);
    byte[] fileContent =
        BlobUtils.getRawContent(gitClient.getRepository(), commit.getId(), filePath);
    FileMetrics metrics = fileAnalyzer.analyzeFile(analyzers, filePath, fileContent);
    FileMetricsWithChangeType metricsWithChangeType =
        new FileMetricsWithChangeType(
            metrics, changeTypeMapper.jgitToCoderadar(diff.getChangeType()));
    metricsProcessor.processMetrics(metricsWithChangeType, gitClient, commit.getId(), filePath);
  }
  metricsProcessor.onCommitFinished(gitClient, commit.getId());
}
 
开发者ID:reflectoring,项目名称:coderadar,代码行数:33,代码来源:AnalyzingCommitProcessor.java

示例8: getShortMessage

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
public ArrayList<String> getShortMessage() {
        for (RevCommit revision : walk) {
            shortMessage.add(revision.getShortMessage());
//[LOG]            logger.debug(revision.getShortMessage());
            DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
            df.setRepository(repository);
            df.setDiffComparator(RawTextComparator.DEFAULT);
            df.setDetectRenames(true);
            RevCommit parent = null;
            if(revision.getParentCount()!=0) {
                try {
                    parent = walk.parseCommit(revision.getParent(0).getId());
                    RevTree tree = revision.getTree();
                    List<DiffEntry> diffs = df.scan(parent.getTree(), revision.getTree());
                    for (DiffEntry diff : diffs) {
                        String changeType = diff.getChangeType().name();
                        if(changeType.equals(ADD)|| changeType.equals(MODIFY))
                        {
//[LOG]                            logger.debug(diff.getChangeType().name());
//[LOG]                            logger.debug(diff.getNewPath());
                            tempCommitHistory.add(diff.getNewPath());
                        }
                    }
                }catch (IOException ex) {
//[LOG]                    logger.debug("IOException", ex);
                }
            }
            commitSHA.add(commitCount,revision.name());
            commitHistory.add(commitCount++,new ArrayList<String>(tempCommitHistory));
            tempCommitHistory.clear();
        }
        walk.reset();
        return shortMessage;
    }
 
开发者ID:jughyd,项目名称:GitFx,代码行数:35,代码来源:GitRepoMetaData.java

示例9: getChangesForCommitedFiles

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private List<Change> getChangesForCommitedFiles(String hash) throws IOException {
	RevWalk revWalk = new RevWalk(git.getRepository());
	RevCommit commit = revWalk.parseCommit(ObjectId.fromString(hash));

	if (commit.getParentCount() > 1) {
		revWalk.close();
		return new ArrayList<Change>();
	}

	RevCommit parentCommit = commit.getParentCount() > 0
			? revWalk.parseCommit(ObjectId.fromString(commit.getParent(0).getName()))
					: null;

			DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
			df.setBinaryFileThreshold(2048);
			df.setRepository(git.getRepository());
			df.setDiffComparator(RawTextComparator.DEFAULT);
			df.setDetectRenames(true);

			List<DiffEntry> diffEntries = df.scan(parentCommit, commit);
			df.close();
			revWalk.close();

			List<Change> changes = new ArrayList<Change>();
			for (DiffEntry entry : diffEntries) {
				Change change = new Change(entry.getNewPath(), entry.getOldPath(), 0, 0,
						ChangeType.valueOf(entry.getChangeType().name()));
				analyzeDiff(change, entry);
				changes.add(change);
			}

			return changes;
}
 
开发者ID:visminer,项目名称:repositoryminer,代码行数:34,代码来源:GitSCM.java

示例10: getRevisionObj

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private Revision getRevisionObj(Repository repository, RevCommit commit) throws IOException {
    String commitSHA = commit.getName();
    Date commitTime = commit.getAuthorIdent().getWhen();
    String comment = commit.getFullMessage().trim();
    String user = commit.getAuthorIdent().getName();
    String emailId = commit.getAuthorIdent().getEmailAddress();
    List<ModifiedFile> modifiedFiles = new ArrayList<ModifiedFile>();
    if (commit.getParentCount() == 0) {
        TreeWalk treeWalk = new TreeWalk(repository);
        treeWalk.addTree(commit.getTree());
        treeWalk.setRecursive(false);
        while (treeWalk.next()) {
            modifiedFiles.add(new ModifiedFile(treeWalk.getPathString(), "added"));
        }
    } else {
        RevWalk rw = new RevWalk(repository);
        RevCommit parent = rw.parseCommit(commit.getParent(0).getId());
        DiffFormatter diffFormatter = new DiffFormatter(DisabledOutputStream.INSTANCE);
        diffFormatter.setRepository(repository);
        diffFormatter.setDiffComparator(RawTextComparator.DEFAULT);
        diffFormatter.setDetectRenames(true);
        List<DiffEntry> diffEntries = diffFormatter.scan(parent.getTree(), commit.getTree());
        for (DiffEntry diffEntry : diffEntries) {
            modifiedFiles.add(new ModifiedFile(diffEntry.getNewPath(), getAction(diffEntry.getChangeType().name())));
        }
    }

    return new Revision(commitSHA, commitTime, comment, user, emailId, modifiedFiles);
}
 
开发者ID:gocd,项目名称:go-plugins,代码行数:30,代码来源:JGitHelper.java

示例11: walkTouchedFilesInCommit

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private void walkTouchedFilesInCommit(Git gitClient, Commit commit, FilePatternMatcher matcher)
    throws IOException {
  RevCommit gitCommit = commitFinder.findCommit(gitClient, commit.getName());
  DiffFormatter diffFormatter = new DiffFormatter(DisabledOutputStream.INSTANCE);
  diffFormatter.setRepository(gitClient.getRepository());
  diffFormatter.setDiffComparator(RawTextComparator.DEFAULT);
  diffFormatter.setDetectRenames(true);

  int fileCounter = 0;
  if (gitCommit.getParentCount() > 0) {
    RevCommit parent = gitCommit.getParent(0);
    List<DiffEntry> diffs = diffFormatter.scan(parent, gitCommit);
    for (DiffEntry diff : diffs) {

      if (!matcher.matches(diff.getNewPath())) {
        continue;
      }

      String hash = createHash(gitClient, gitCommit, diff.getNewPath());
      ChangeType changeType = changeTypeMapper.jgitToCoderadar(diff.getChangeType());
      if (changeType == ChangeType.ADD || changeType == ChangeType.COPY) {
        // we want to add ADDED and COPIED log entries only once for the same file
        if (entryWithSameFileAlreadyExists(
            commit.getProject().getId(), diff.getNewPath(), changeType, hash)) {
          continue;
        }
      }

      GitLogEntry logEntry = new GitLogEntry();
      logEntry.setOldFilepath(diff.getOldPath());
      logEntry.setFilepath(diff.getNewPath());
      logEntry.setProject(commit.getProject());
      logEntry.setChangeType(changeType);
      logEntry.setCommit(commit);
      logEntry.setFileHash(hash);

      logEntryRepository.save(logEntry);
      fileCounter++;
      filesMeter.mark();
    }
    commit.setScanned(true);
    commitRepository.save(commit);
    logger.info("scanned {} files in commit {}", fileCounter, commit);
  }
}
 
开发者ID:reflectoring,项目名称:coderadar,代码行数:46,代码来源:FileMetadataScanner.java

示例12: getEditedRegions

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
@Override
public List<EditedRegion> getEditedRegions(String filePath) throws GitException {
  try (ObjectReader reader = repository.newObjectReader();
      RevWalk revWalk = new RevWalk(repository);
      DiffFormatter formatter = new DiffFormatter(DisabledOutputStream.INSTANCE)) {
    formatter.setRepository(repository);
    formatter.setPathFilter(PathFilter.create(filePath));

    Ref headRef = repository.exactRef(HEAD);
    RevCommit commit = revWalk.parseCommit(headRef.getObjectId());
    RevTree tree = revWalk.parseTree(commit.getTree().getId());
    CanonicalTreeParser treeParser = new CanonicalTreeParser();
    treeParser.reset(reader, tree);

    Optional<DiffEntry> optional =
        formatter.scan(treeParser, new FileTreeIterator(repository)).stream().findAny();
    if (optional.isPresent()) {
      EditList edits = formatter.toFileHeader(optional.get()).getHunks().get(0).toEditList();
      return edits
          .stream()
          .map(
              edit -> {
                EditedRegionType type = null;
                switch (edit.getType()) {
                  case INSERT:
                    {
                      type = INSERTION;
                      break;
                    }
                  case REPLACE:
                    {
                      type = MODIFICATION;
                      break;
                    }
                  case DELETE:
                    {
                      type = DELETION;
                      break;
                    }
                  case EMPTY:
                    {
                      break;
                    }
                }
                return newDto(EditedRegion.class)
                    .withBeginLine(
                        edit.getType() == DELETE ? edit.getBeginB() : edit.getBeginB() + 1)
                    .withEndLine(edit.getEndB())
                    .withType(type);
              })
          .collect(toList());
    }
  } catch (Exception e) {
    throw new GitException(e.getMessage());
  }
  return Collections.emptyList();
}
 
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:JGitConnection.java

示例13: ExtractCommitInfo

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
private static CommitNode ExtractCommitInfo(RevCommit _revCommit, Repository _repo, Date later) {
	
	CommitNode c = new CommitNode(null);

	
	RevWalk rw = new RevWalk(_repo);
	try {
		/*if (commit == null) {
			ObjectId object = getDefaultBranch(repository);
			commit = rw.parseCommit(object);
		}*/

		if (_revCommit.getParentCount() == 0) {
			TreeWalk tw = new TreeWalk(_repo);
			tw.reset();
			tw.setRecursive(true);
			tw.addTree(_revCommit.getTree());
			c.date = _revCommit.getAuthorIdent().getWhen();
			
			if ( (later != null) && c.date.before(later)){
				return null;
			}
			
			while (tw.next()) {
				
				if (isJavaFile(tw.getPathString())){
					c.files.add(new FileNode(tw.getPathString(), tw.getPathString(),
							tw.getObjectId(0), null, ChangeType.ADD));
				}
			}
			tw.release();
		} else {
			RevCommit parent = rw.parseCommit(_revCommit.getParent(0).getId());
			DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
			df.setRepository(_repo);	
			df.setDiffComparator(RawTextComparator.DEFAULT);
			df.setDetectRenames(true);
			List<DiffEntry> diffs = df.scan(parent.getTree(), _revCommit.getTree());
			c.date = _revCommit.getAuthorIdent().getWhen();
			
			if ((later != null) && c.date.before(later)){
				return null;
			}
			
			for (DiffEntry diff : diffs) {
				
				if (diff.getChangeType().equals(ChangeType.ADD)) {
					if (isJavaFile(diff.getNewPath())){
						c.files.add(new FileNode(diff.getNewPath(), null,
							diff.getNewId().toObjectId(), null, diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.DELETE)) {
					if (isJavaFile(diff.getOldPath())){
						c.files.add(new FileNode(null, diff.getOldPath(),
							null, diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.RENAME)) {
					if (isJavaFile(diff.getNewPath())){
						c.files.add(new FileNode(diff.getNewPath(), diff.getOldPath(),
							diff.getNewId().toObjectId(), diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.MODIFY)){
					if (isJavaFile(diff.getNewPath())){
						c.files.add(new FileNode(diff.getNewPath(), null,
							diff.getNewId().toObjectId(), diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				}
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		rw.dispose();
	}
	
	return c;
}
 
开发者ID:gems-uff,项目名称:dominoes,代码行数:78,代码来源:CommitNode.java

示例14: parse

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
public void parse(RepositoryNode _repo) {
	
	RevWalk rw = new RevWalk(_repo.getRepository());
	try {
		/*if (commit == null) {
			ObjectId object = getDefaultBranch(repository);
			commit = rw.parseCommit(object);
		}*/

		if (revCommit.getParentCount() == 0) {
			TreeWalk tw = new TreeWalk(_repo.getRepository());
			tw.reset();
			tw.setRecursive(true);
			tw.addTree(revCommit.getTree());

			
			while (tw.next()) {
				
				if (isJavaFile(tw.getPathString())){
					files.add(new FileNode(tw.getPathString(), tw.getPathString(),
						tw.getObjectId(0), null, ChangeType.ADD));
				}
			}
			tw.release();
		} else {
			RevCommit parent = rw.parseCommit(revCommit.getParent(0).getId());
			DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
			df.setRepository(_repo.getRepository());	
			df.setDiffComparator(RawTextComparator.DEFAULT);
			df.setDetectRenames(true);
			List<DiffEntry> diffs = df.scan(parent.getTree(), revCommit.getTree());
			
			for (DiffEntry diff : diffs) {
				
				if (diff.getChangeType().equals(ChangeType.ADD)) {
					if (isJavaFile(diff.getNewPath())){
						files.add(new FileNode(diff.getNewPath(), null,
							diff.getNewId().toObjectId(), null, diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.DELETE)) {
					if (isJavaFile(diff.getOldPath())){
						files.add(new FileNode(null, diff.getOldPath(),
							null, diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.RENAME)) {
					if (isJavaFile(diff.getNewPath())){
						files.add(new FileNode(diff.getNewPath(), diff.getOldPath(),
							diff.getNewId().toObjectId(), diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				} else if (diff.getChangeType().equals(ChangeType.MODIFY)){
					if (isJavaFile(diff.getNewPath())){
						files.add(new FileNode(diff.getNewPath(), null,
							diff.getNewId().toObjectId(), diff.getOldId().toObjectId(), diff.getChangeType()));
					}
				}
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		rw.dispose();
	}
	
	
	for (FileNode f : files){
		f.Parse(_repo.getRepository());
	}
}
 
开发者ID:gems-uff,项目名称:dominoes,代码行数:69,代码来源:CommitNode.java

示例15: findCommits

import org.eclipse.jgit.util.io.DisabledOutputStream; //导入依赖的package包/类
List<GitCommit> findCommits() throws IOException {
    Repository repository = getRepository();

    List<GitCommit> result = new LinkedList<>();

    ObjectId head = repository.resolve("HEAD");
    logger.debug("Found head: {}", head);

    RevWalk rw = new RevWalk(repository);

    try (Git git = new Git(repository)) {
        LogCommand logCommand = getLogWithOrWithOutRange(git, range);
        Iterable<RevCommit> commits = logCommand.call();

        DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE);
        df.setRepository(repository);
        df.setDiffComparator(RawTextComparator.DEFAULT);
        df.setDetectRenames(true);

        for (RevCommit commit : commits) {
            logger.debug("Commit-Message: '{}'", commit.getShortMessage());
            final Date date = new Date(1000 * (long) commit.getCommitTime());
            final GitCommit gitCommit = retrieveCommit(ObjectId.toString(commit.getId()));
            gitCommit.setAuthor(makeStringOfIdent(commit.getAuthorIdent()));
            gitCommit.setCommitter(makeStringOfIdent(commit.getCommitterIdent()));
            gitCommit.setDate(date);
            gitCommit.setMessage(commit.getFullMessage());
            gitCommit.setShortMessage(commit.getShortMessage());
            gitCommit.setEncoding(commit.getEncodingName());
            addCommitParents(rw, df, commit, gitCommit);

            result.add(gitCommit);
        }
    } catch (GitAPIException e) {
        throw new IllegalStateException("Could not read logs from Git repository '" + path + "'", e);
    } finally {
        rw.close();
        repository.close();
    }

    logger.debug("Found #{} commits", result.size());
    return result;
}
 
开发者ID:kontext-e,项目名称:jqassistant-plugins,代码行数:44,代码来源:JGitScanner.java


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