Java源码示例:org.eclipse.jgit.api.errors.CanceledException
示例1
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;
}
示例2
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;
}
示例3
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);
}
示例4
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();
}
示例5
private static void pull(final Git git) throws GitAPIException, WrongRepositoryStateException,
InvalidConfigurationException, InvalidRemoteException, CanceledException, RefNotFoundException,
RefNotAdvertisedException, NoHeadException, TransportException {
pull(git, (ProgressMonitor) null);
}
示例6
public void pullFromRepo()
throws IOException, WrongRepositoryStateException, InvalidConfigurationException, DetachedHeadException,
InvalidRemoteException, CanceledException, RefNotFoundException, NoHeadException, GitAPIException {
git.pull().call();
}