org.eclipse.jgit.errors.RevisionSyntaxException Java Examples

The following examples show how to use org.eclipse.jgit.errors.RevisionSyntaxException. 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: GitMergeUtil.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the last commit in the given branch of the given git repository.
 */
private RevCommit getLastCommit(final String branch) {
	try {
		final Iterable<RevCommit> call = repo.log().setMaxCount(1).add(repo.getRepository().resolve(branch))
				.call();
		return call.iterator().next();
	} catch (RevisionSyntaxException | IOException | GitAPIException e) {
		exception = new MergeUnitException(
				String.format("Could not get last commit for the given branch '%s'", branch), e); //$NON-NLS-1$
		return null;
	}
}
 
Example #2
Source File: ChurnRateCalculator.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
public void setRemoreCommits() throws IOException, RevisionSyntaxException, NoHeadException, GitAPIException {
	System.out.println(localPath + "/.git");

	/////////////////////// this should be move to an instance variable

	// stores into appropriate instance variables (HashMap localCommits) the commits
	// of each branch
	for (int i = 0; i < remoteBranches.size(); i++) {

		// for each branch create a list of lists with the total commits
		// the next for loop stores the list of all commits of each branch
		// to allCommitsSpecificBranchRemote list and then add that list to allCommits
		// list
		List<String> allCommitsSpecificBranchRemote = new ArrayList<>();

		// loop for each commit of all the commits of each branch
		for (RevCommit commit : repo.log().add(myrepo.resolve(remoteBranches.get(i))).call()) {

			allCommitsSpecificBranchRemote.add(commit.getName());

		}

		// after each loop it adds allCommitsSpecificBranchRemote List to allCommits
		// list of lists
		// allCommits.add(allCommitsSpecificBranchRemote);

		// stores all commits lists with key value of a specific branch to hashmap
		// remoteCommits
		remoteCommits.put(remoteBranches.get(i), allCommitsSpecificBranchRemote);
		// remoteCommits.put(remoteBranches.get(i), allCommits.get(i));

	}

	this.getCommits(remoteCommits);

	// myrepo.close();

}
 
Example #3
Source File: GitSCM.java    From repositoryminer with Apache License 2.0 5 votes vote down vote up
private Iterable<RevCommit> getCommitsFromBranch(String refName) {
	try {
		return git.log().add(git.getRepository().resolve(refName)).call();
	} catch (RevisionSyntaxException | GitAPIException | IOException e) {
		close();
		throw new RepositoryMinerException(e);
	}
}
 
Example #4
Source File: ChurnRateCalculator.java    From scava with Eclipse Public License 2.0 3 votes vote down vote up
public void setDiffsAll() throws RevisionSyntaxException, AmbiguousObjectException, IncorrectObjectTypeException,
		IOException, GitAPIException {

	for (int i = 0; i < this.remoteBranches.size(); i++) {

		this.setDiffsToBranch(this.remoteBranches.get(i));

	}

}
 
Example #5
Source File: ChurnRateCalculator.java    From scava with Eclipse Public License 2.0 2 votes vote down vote up
public ObjectId getHead()
		throws RevisionSyntaxException, AmbiguousObjectException, IncorrectObjectTypeException, IOException {

	return repo.getRepository().resolve(Constants.HEAD);

}