org.eclipse.jgit.lib.NullProgressMonitor Java Examples
The following examples show how to use
org.eclipse.jgit.lib.NullProgressMonitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaestroAgent.java From maestro-java with Apache License 2.0 | 4 votes |
@Override public void handle(final AgentSourceRequest note) { logger.info("Source request arrived"); final String sourceUrl = note.getSourceUrl(); final String branch = note.getBranch(); if (branch == null) { logger.info("Preparing to download code from {}", sourceUrl); } else { logger.info("Preparing to download code from {} from branch {}", sourceUrl, branch); } final String projectDir = UUID.randomUUID().toString(); final File repositoryDir = new File(sourceRoot + File.separator + projectDir + File.separator); if (!repositoryDir.exists()) { if (!repositoryDir.mkdirs()) { logger.warn("Unable to create directory: {}", repositoryDir); } } CloneCommand cloneCommand = Git.cloneRepository(); cloneCommand.setURI(sourceUrl); cloneCommand.setDirectory(repositoryDir); cloneCommand.setProgressMonitor(NullProgressMonitor.INSTANCE); if (branch != null) { cloneCommand.setBranch(branch); } try { cloneCommand.call(); logger.info("Source directory for project created at {}", repositoryDir); extensionPoints.add(new ExtensionPoint(new File(repositoryDir, "requests"), true)); getClient().replyOk(note); } catch (GitAPIException e) { logger.error("Unable to clone repository: {}", e.getMessage(), e); getClient().replyInternalError(note,"Unable to clone repository: %s", e.getMessage()); } }
Example #2
Source File: ExportDiffCommand.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected void run() throws GitException { Repository repository = getRepository(); String workTreePath = repository.getWorkTree().getAbsolutePath(); try (DiffFormatter formatter = new DiffFormatter(out); ObjectReader or = repository.newObjectReader()) { formatter.setRepository(repository); Collection<PathFilter> pathFilters = Utils.getPathFilters(repository.getWorkTree(), roots); if (!pathFilters.isEmpty()) { formatter.setPathFilter(PathFilterGroup.create(pathFilters)); } if (repository.getConfig().get(WorkingTreeOptions.KEY).getAutoCRLF() != CoreConfig.AutoCRLF.FALSE) { // work-around for autocrlf formatter.setDiffComparator(new AutoCRLFComparator()); } AbstractTreeIterator firstTree = getIterator(firstCommit, or); AbstractTreeIterator secondTree = getIterator(secondCommit, or); List<DiffEntry> diffEntries; if (secondTree instanceof WorkingTreeIterator) { // remote when fixed in JGit, see ExportDiffTest.testDiffRenameDetectionProblem formatter.setDetectRenames(false); diffEntries = formatter.scan(firstTree, secondTree); formatter.setDetectRenames(true); RenameDetector detector = formatter.getRenameDetector(); detector.reset(); detector.addAll(diffEntries); diffEntries = detector.compute(new ContentSource.Pair(ContentSource.create(or), ContentSource.create((WorkingTreeIterator) secondTree)), NullProgressMonitor.INSTANCE); } else { formatter.setDetectRenames(true); diffEntries = formatter.scan(firstTree, secondTree); } for (DiffEntry ent : diffEntries) { if (monitor.isCanceled()) { break; } listener.notifyFile(new File(workTreePath + File.separator + ent.getNewPath()), ent.getNewPath()); formatter.format(ent); } formatter.flush(); } catch (IOException ex) { throw new GitException(ex); } }
Example #3
Source File: RevWalkUtils.java From onedev with MIT License | 3 votes |
/** * Find the list of branches a given commit is reachable from when following * parents. * <p> * Note that this method calls * {@link org.eclipse.jgit.revwalk.RevWalk#reset()} at the beginning. * <p> * In order to improve performance this method assumes clock skew among * committers is never larger than 24 hours. * * @param commit * the commit we are looking at * @param revWalk * The RevWalk to be used. * @param refs * the set of branches we want to see reachability from * @return the list of branches a given commit is reachable from * @throws org.eclipse.jgit.errors.MissingObjectException * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * @throws java.io.IOException */ public static List<Ref> findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, Collection<Ref> refs) throws MissingObjectException, IncorrectObjectTypeException, IOException { return findBranchesReachableFrom(commit, revWalk, refs, NullProgressMonitor.INSTANCE); }
Example #4
Source File: BitmapWalker.java From onedev with MIT License | 3 votes |
/** * Create a BitmapWalker. * * @param walker walker to use when traversing the object graph. * @param bitmapIndex index to obtain bitmaps from. * @param pm progress monitor to report progress on. */ public BitmapWalker( ObjectWalk walker, BitmapIndex bitmapIndex, ProgressMonitor pm) { this.walker = walker; this.bitmapIndex = bitmapIndex; this.pm = (pm == null) ? NullProgressMonitor.INSTANCE : pm; }
Example #5
Source File: Merger.java From onedev with MIT License | 3 votes |
/** * Set a progress monitor. * * @param monitor * Monitor to use, can be null to indicate no progress reporting * is desired. * @since 4.2 */ public void setProgressMonitor(ProgressMonitor monitor) { if (monitor == null) { this.monitor = NullProgressMonitor.INSTANCE; } else { this.monitor = monitor; } }