List of usage examples for org.eclipse.jgit.revwalk RevWalkUtils findBranchesReachableFrom
public static List<Ref> findBranchesReachableFrom(RevCommit commit, RevWalk revWalk, Collection<Ref> refs) throws MissingObjectException, IncorrectObjectTypeException, IOException
From source file:org.eclipse.egit.ui.internal.commit.CommitEditorPage.java
License:Open Source License
private List<Ref> loadBranches() { Repository repository = getCommit().getRepository(); RevCommit commit = getCommit().getRevCommit(); RevWalk revWalk = new RevWalk(repository); try {// w w w .j a v a2 s .com Map<String, Ref> refsMap = new HashMap<String, Ref>(); refsMap.putAll(repository.getRefDatabase().getRefs(Constants.R_HEADS)); refsMap.putAll(repository.getRefDatabase().getRefs(Constants.R_REMOTES)); return RevWalkUtils.findBranchesReachableFrom(commit, revWalk, refsMap.values()); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); return Collections.emptyList(); } }
From source file:org.eclipse.egit.ui.internal.history.CommitInfoBuilder.java
License:Open Source License
/** * @param commit//from w w w . j ava 2s. c om * @param allRefs * @param db * @return List of heads from those current commit is reachable * @throws MissingObjectException * @throws IncorrectObjectTypeException * @throws IOException */ private static List<Ref> getBranches(RevCommit commit, Collection<Ref> allRefs, Repository db) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevWalk revWalk = new RevWalk(db); try { revWalk.setRetainBody(false); return RevWalkUtils.findBranchesReachableFrom(commit, revWalk, allRefs); } finally { revWalk.dispose(); } }
From source file:org.flowerplatform.web.git.history.remote.GitHistoryStatefulService.java
License:Open Source License
private List<Ref> getBranches(RevCommit commit, Collection<Ref> allRefs, Repository db) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevWalk revWalk = new RevWalk(db); try {//w w w . j a v a2 s . c om revWalk.setRetainBody(false); return RevWalkUtils.findBranchesReachableFrom(commit, revWalk, allRefs); } finally { revWalk.dispose(); } }