Java 类org.eclipse.jgit.api.errors.CanceledException 实例源码

项目:PhET    文件:PullAll.java   
private static void visit( File directory ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    for ( final File child : directory.listFiles() ) {
        if ( child.isDirectory() ) {
            visit( child );
        }
        final String name = child.getName();
        if ( name.equals( ".git" ) ) {

            Thread t = new Thread( new Runnable() {
                public void run() {
                    try {
                        Git git = Git.open( child.getParentFile() );
                        PullResult pullResult = git.pull().call();
                        System.out.println( "pulled on " + child.getParentFile().getName() + ", pullResult = " + pullResult.isSuccessful() + ", " + pullResult.getFetchedFrom() + ", fetch messages: " + pullResult.getFetchResult().getMessages() );
                    }
                    catch ( Exception e ) {
                        e.printStackTrace();
                    }
                }
            } );
            t.start();

        }
    }
}
项目:release-maven-plugin-parent    文件:GitProposedTagTest.java   
@Test
public void deleteFailed() throws Exception {
    when(deleteTagCommand.setTags(ANY_NAME)).thenReturn(deleteTagCommand);
    when(git.tagDelete()).thenReturn(deleteTagCommand);

    final GitAPIException expected = new CanceledException(ANY_MESSAGE);
    doThrow(expected).when(deleteTagCommand).call();

    try {
        tag.delete();
        fail("Exception expected!");
    } catch (final SCMException e) {
        assertEquals("Remote tag 'anyName' could not be deleted!", e.getMessage());
        assertSame(expected, e.getCause());
    }
}
项目:release-maven-plugin-parent    文件:GitProposedTagTest.java   
@Test
public void saveAtHEADFailed() throws Exception {
    prepareTagAndPush();

    final GitAPIException expected = new CanceledException(ANY_MESSAGE);
    doThrow(expected).when(tagCommand).call();
    try {
        tag.tagAndPush();
        fail("Exception expected");
    } catch (final SCMException e) {
        assertEquals("Ref 'anyName' could be saved at HEAD!", e.getMessage());
        assertSame(expected, e.getCause());
    }
}
项目:release-maven-plugin-parent    文件:GitProposedTagTest.java   
@Test
public void tagAndPushFailed() throws Exception {
    prepareTagAndPush();

    final GitAPIException expected = new CanceledException(ANY_MESSAGE);
    doThrow(expected).when(pushCommand).call();
    try {
        tag.tagAndPush();
        fail("Exception expected");
    } catch (final SCMException e) {
        assertEquals("Tag 'anyName' could not be pushed!", e.getMessage());
        assertSame(expected, e.getCause());
    }
}
项目:ivy-pdi-git-steps    文件:PullGitCommand.java   
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException,
    WrongRepositoryStateException, InvalidConfigurationException,
    DetachedHeadException, InvalidRemoteException, CanceledException,
    RefNotFoundException, NoHeadException, TransportException,
    GitAPIException {
  git.pull().setCredentialsProvider(cp).setRebase(rebase).call();
  return git;
}
项目:PhET    文件:PullAll.java   
public static void main( String[] args ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    visit( new File( "C:\\workingcopy\\phet-little-gits" ) );
}