org.eclipse.jgit.api.errors.WrongRepositoryStateException Java Examples

The following examples show how to use org.eclipse.jgit.api.errors.WrongRepositoryStateException. 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: GitWorkspaceSync.java    From milkman with MIT License 6 votes vote down vote up
private Git refreshRepository(GitSyncDetails syncDetails, File syncDir)
		throws GitAPIException, InvalidRemoteException, TransportException, IOException,
		WrongRepositoryStateException, InvalidConfigurationException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException {
	Git repo;
	if (!syncDir.exists()) {
		syncDir.mkdirs();
		repo = initWith(Git.cloneRepository(), syncDetails)
			.setURI(syncDetails.getGitUrl())
			.setDirectory(syncDir)
			.setCloneAllBranches(true)
			.setBranch("master")
			.call();
		
		
	} else {
		repo = Git.open(syncDir);
		initWith(repo.pull(), syncDetails)
			.call();
	}
	return repo;
}
 
Example #2
Source File: JGitUtil.java    From mcg-helper with Apache License 2.0 5 votes vote down vote up
public static boolean pull(String projectPath, String branch, String user, String pwd) throws IOException, WrongRepositoryStateException, InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException, RefNotAdvertisedException, NoHeadException, TransportException, GitAPIException {

		try (Git git = Git.open(new File(projectPath)) ) {
			UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(user, pwd);
			git.pull().setRemoteBranchName(branch)
					.setCredentialsProvider(provider)
					.setProgressMonitor(new PullProgressMonitor())
					.call();
		}
		
		return true;
	}
 
Example #3
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private static void pull(final Git git, IProgressMonitor monitor)
		throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	@SuppressWarnings("restriction")
	ProgressMonitor gitMonitor = (null == monitor) ? createMonitor()
			: new org.eclipse.egit.core.EclipseGitProgressTransformer(monitor);
	pull(git, gitMonitor);
}
 
Example #4
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private static void pull(final Git git, ProgressMonitor monitor)
		throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	git.pull().setTransportConfigCallback(TRANSPORT_CALLBACK).setProgressMonitor(monitor).call();
}
 
Example #5
Source File: TagBasedVersionFactoryTest.java    From gradle-gitsemver with Apache License 2.0 5 votes vote down vote up
@Before
public void createVersionFactory() throws IOException, NoHeadException,
        NoMessageException, UnmergedPathsException,
        ConcurrentRefUpdateException, WrongRepositoryStateException,
        GitAPIException {
    repo = createRepository();
    git = initializeGitFlow(repo);
    versionFactory = new TagBasedVersionFactory();
}
 
Example #6
Source File: TagBasedVersionFactoryTest.java    From gradle-gitsemver with Apache License 2.0 5 votes vote down vote up
@Test
public void testCommitCount() throws NoHeadException, NoMessageException,
        UnmergedPathsException, ConcurrentRefUpdateException,
        WrongRepositoryStateException, GitAPIException,
        NoWorkTreeException, IOException {
    tag("v0.1.1-rc");
    makeCommit();
    makeCommit();
    RevCommit head = makeCommit();
    validateUnstable("0.1.1-rc", 3, head, Dirty.NO, DOT);
}
 
Example #7
Source File: GitUtils.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private static void pull(final Git git) throws GitAPIException, WrongRepositoryStateException,
		InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
		RefNotAdvertisedException, NoHeadException, TransportException {

	pull(git, (ProgressMonitor) null);
}
 
Example #8
Source File: GitControl.java    From juneau with Apache License 2.0 4 votes vote down vote up
public void commitToRepo(String message) throws IOException, NoHeadException, NoMessageException,
		ConcurrentRefUpdateException, JGitInternalException, WrongRepositoryStateException, GitAPIException {
	git.commit().setMessage(message).call();
}
 
Example #9
Source File: GitControl.java    From juneau with Apache License 2.0 4 votes vote down vote up
public void pullFromRepo()
		throws IOException, WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException,
		InvalidRemoteException, CanceledException, RefNotFoundException, NoHeadException, GitAPIException {
	git.pull().call();
}
 
Example #10
Source File: TagBasedVersionFactoryTest.java    From gradle-gitsemver with Apache License 2.0 4 votes vote down vote up
private RevCommit makeCommit() throws NoHeadException, NoMessageException,
        UnmergedPathsException, ConcurrentRefUpdateException,
        WrongRepositoryStateException, GitAPIException {
    return git.commit().setCommitter(COMMITTER).setMessage("some commit").call();
}