/// <summary> /// Executes the /// <code>fetch</code> /// command with all the options and parameters /// collected by the setter methods of this class. Each instance of this /// class should only be used for one invocation of the command (means: one /// call to /// <see cref="Call()">Call()</see> /// ) /// </summary> /// <returns> /// a /// <see cref="NGit.Transport.FetchResult">NGit.Transport.FetchResult</see> /// object representing the successful fetch /// result /// </returns> /// <exception cref="NGit.Api.Errors.InvalidRemoteException">when called with an invalid remote uri /// </exception> /// <exception cref="NGit.Api.Errors.JGitInternalException"> /// a low-level exception of JGit has occurred. The original /// exception can be retrieved by calling /// <see cref="System.Exception.InnerException()">System.Exception.InnerException()</see> /// . /// </exception> public override FetchResult Call() { CheckCallable(); try { NGit.Transport.Transport transport = NGit.Transport.Transport.Open(repo, remote); try { transport.SetCheckFetchedObjects(checkFetchedObjects); transport.SetRemoveDeletedRefs(removeDeletedRefs); transport.SetTimeout(timeout); transport.SetDryRun(dryRun); if (tagOption != null) { transport.SetTagOpt(tagOption); } transport.SetFetchThin(thin); if (credentialsProvider != null) { transport.SetCredentialsProvider(credentialsProvider); } FetchResult result = transport.Fetch(monitor, refSpecs); return(result); } finally { transport.Close(); } } catch (NoRemoteRepositoryException e) { throw new InvalidRemoteException(MessageFormat.Format(JGitText.Get().invalidRemote , remote), e); } catch (TransportException e) { throw new JGitInternalException(JGitText.Get().exceptionCaughtDuringExecutionOfFetchCommand , e); } catch (URISyntaxException) { throw new InvalidRemoteException(MessageFormat.Format(JGitText.Get().invalidRemote , remote)); } catch (NotSupportedException e) { throw new JGitInternalException(JGitText.Get().exceptionCaughtDuringExecutionOfFetchCommand , e); } }