List of usage examples for org.eclipse.jgit.revplot PlotCommitList PlotCommitList
PlotCommitList
From source file:com.gitblit.tests.JGitUtilsTest.java
License:Apache License
@Test public void testPlots() throws Exception { Repository repository = GitBlitSuite.getTicgitRepository(); PlotWalk pw = new PlotWalk(repository); PlotCommitList<PlotLane> commits = new PlotCommitList<PlotLane>(); commits.source(pw);//w w w .j av a 2s .co m commits.fillTo(25); for (PlotCommit<PlotLane> commit : commits) { System.out.println(commit); } repository.close(); }
From source file:com.madgag.agit.CommitViewerActivity.java
License:Open Source License
private PlotWalk generatePlotWalk() throws IOException { long start = currentTimeMillis(); PlotWalk revWalk = new PlotWalk(repo()); for (ObjectId startId : logStartProvider.get()) { revWalk.markStart(revWalk.parseCommit(startId)); }/*w w w . jav a 2 s . c o m*/ PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>(); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); long duration = currentTimeMillis() - start; Log.d(TAG, "generatePlotWalk duration" + duration); return revWalk; }
From source file:de.fau.osr.core.vcs.impl.GitVcsClient.java
License:Open Source License
public Iterator<String> getCommitListForFileodification(String path) { String filename = path.replaceAll(Matcher.quoteReplacement("\\"), "/"); PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>(); PlotWalk revWalk = new PlotWalk(repo); ArrayList<String> commitIDList = new ArrayList<String>(); try {//from w w w .j av a 2 s . com ObjectId rootId = repo.resolve("HEAD"); if (rootId != null) { RevCommit root = revWalk.parseCommit(rootId); revWalk.markStart(root); revWalk.setTreeFilter( // VERY IMPORTANT: This works only with unix-style file paths. NO "\" allowed. AndTreeFilter.create(PathFilter.create(filename), TreeFilter.ANY_DIFF)); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); Iterator<PlotCommit<PlotLane>> commitListIterator = plotCommitList.iterator(); while (commitListIterator.hasNext()) { commitIDList.add(commitListIterator.next().getName()); } return commitIDList.iterator(); } } catch (AmbiguousObjectException ex) { } catch (IOException ex) { } return commitIDList.iterator(); }
From source file:edu.nju.cs.inform.jgit.unfinished.ListChildrenOfCommit.java
License:Apache License
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { try (PlotWalk revWalk = new PlotWalk(repository)) { ObjectId rootId = repository.resolve("refs/heads/master"); RevCommit root = revWalk.parseCommit(rootId); revWalk.markStart(root);/*from ww w.j a v a2 s.co m*/ PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<>(); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); System.out.println("Printing children of commit " + root); for (RevCommit com : revWalk) { System.out.println("Child: " + com); } System.out.println("Printing with next()"); System.out.println("next: " + revWalk.next()); } } }
From source file:org.commonjava.aprox.subsys.git.GitManager.java
License:Apache License
public ChangeSummary getHeadCommit(final File f) throws GitSubsystemException { try {//from w w w . ja va 2 s. c o m final ObjectId oid = repo.resolve("HEAD"); final PlotWalk pw = new PlotWalk(repo); final RevCommit rc = pw.parseCommit(oid); pw.markStart(rc); final String filepath = relativize(f); pw.setTreeFilter(AndTreeFilter.create(PathFilter.create(filepath), TreeFilter.ANY_DIFF)); final PlotCommitList<PlotLane> cl = new PlotCommitList<>(); cl.source(pw); cl.fillTo(1); final PlotCommit<PlotLane> commit = cl.get(0); return toChangeSummary(commit); } catch (RevisionSyntaxException | IOException e) { throw new GitSubsystemException("Failed to resolve HEAD commit for: %s. Reason: %s", e, f, e.getMessage()); } }
From source file:org.commonjava.indy.subsys.git.GitManager.java
License:Apache License
public ChangeSummary getHeadCommit(final File f) throws GitSubsystemException { return lockAnd(me -> { try {/*ww w. ja va 2s . co m*/ final ObjectId oid = repo.resolve("HEAD"); final PlotWalk pw = new PlotWalk(repo); final RevCommit rc = pw.parseCommit(oid); pw.markStart(rc); final String filepath = relativize(f); pw.setTreeFilter(AndTreeFilter.create(PathFilter.create(filepath), TreeFilter.ANY_DIFF)); final PlotCommitList<PlotLane> cl = new PlotCommitList<>(); cl.source(pw); cl.fillTo(1); final PlotCommit<PlotLane> commit = cl.get(0); return toChangeSummary(commit); } catch (RevisionSyntaxException | IOException e) { throw new GitSubsystemException("Failed to resolve HEAD commit for: %s. Reason: %s", e, f, e.getMessage()); } }); }
From source file:org.efaps.cli.rest.ImportCICall.java
License:Apache License
/** * Gets the file information./*w w w .j a v a 2 s . c o m*/ * * @param _file the _file * @return the file information */ protected String[] getFileInformation(final File _file) { final String[] ret = new String[2]; try { final Repository repo = new FileRepository(evalGitDir(_file)); final ObjectId lastCommitId = repo.resolve(Constants.HEAD); final PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>(); final PlotWalk revWalk = new PlotWalk(repo); final RevCommit root = revWalk.parseCommit(lastCommitId); revWalk.markStart(root); revWalk.setTreeFilter(AndTreeFilter.create( PathFilter.create(_file.getPath().replaceFirst(repo.getWorkTree().getPath() + "/", "")), TreeFilter.ANY_DIFF)); plotCommitList.source(revWalk); plotCommitList.fillTo(2); final PlotCommit<PlotLane> commit = plotCommitList.get(0); if (commit != null) { final PersonIdent authorIdent = commit.getAuthorIdent(); final Date authorDate = authorIdent.getWhen(); final TimeZone authorTimeZone = authorIdent.getTimeZone(); final DateTime dateTime = new DateTime(authorDate.getTime(), DateTimeZone.forTimeZone(authorTimeZone)); ret[1] = dateTime.toString(); ret[0] = commit.getId().getName(); } else { ret[1] = new DateTime().toString(); ret[0] = "UNKNOWN"; } } catch (final RevisionSyntaxException | IOException e) { e.printStackTrace(); } return ret; }
From source file:org.efaps.eclipse.rest.RestClient.java
License:Apache License
protected String[] getFileInformation(final File _file) { final String[] ret = new String[2]; try {//from w w w . j a v a 2 s .com final Repository repo = new FileRepository(evalGitDir(_file)); final ObjectId lastCommitId = repo.resolve(Constants.HEAD); final PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>(); final PlotWalk revWalk = new PlotWalk(repo); final RevCommit root = revWalk.parseCommit(lastCommitId); revWalk.markStart(root); revWalk.setTreeFilter(AndTreeFilter.create( PathFilter.create(_file.getPath().replaceFirst(repo.getWorkTree().getPath() + "/", "")), TreeFilter.ANY_DIFF)); plotCommitList.source(revWalk); plotCommitList.fillTo(2); final PlotCommit<PlotLane> commit = plotCommitList.get(0); if (commit != null) { final PersonIdent authorIdent = commit.getAuthorIdent(); final Date authorDate = authorIdent.getWhen(); final TimeZone authorTimeZone = authorIdent.getTimeZone(); final DateTime dateTime = new DateTime(authorDate.getTime(), DateTimeZone.forTimeZone(authorTimeZone)); ret[1] = dateTime.toString(); ret[0] = commit.getId().getName(); } else { ret[1] = new DateTime().toString(); ret[0] = "UNKNOWN"; } } catch (RevisionSyntaxException | IOException e) { e.printStackTrace(); } return ret; }