Ejemplo n.º 1
0
        public virtual void Fetch(Remote remote, IEnumerable <string> refspecs, FetchOptions options, string logMessage)
        {
            Ensure.ArgumentNotNull(remote, "remote");
            Ensure.ArgumentNotNull(refspecs, "refspecs");

            Commands.Fetch(repository, remote.Name, refspecs, options, logMessage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fetch changes from the configured upstream remote and branch into the branch pointed at by HEAD.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="remoteNameOrPath">The remote name or repository path.</param>
        /// <param name="merger">The signature to use for the merge.</param>
        /// <param name="options">The options for fetch and merging.</param>
        public static MergeResult Pull(Repository repository, string remoteNameOrPath, Signature merger, PullOptions options = null)
        {
            Ensure.ArgumentNotNull(repository, "repository");
            Ensure.ArgumentNotNull(merger, "merger");


            options = options ?? new PullOptions();
            Commands.Fetch(repository, remoteNameOrPath, new string[0], options.FetchOptions, null);
            return(repository.MergeFetchedRefs(merger, options.MergeOptions));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fetch from a url with a set of fetch refspecs
        /// </summary>
        /// <param name="url">The url to fetch from</param>
        /// <param name="refspecs">The list of resfpecs to use</param>
        /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
        /// <param name="logMessage">Message to use when updating the reflog.</param>
        public virtual void Fetch(
            string url,
            IEnumerable <string> refspecs,
            FetchOptions options,
            string logMessage)
        {
            Ensure.ArgumentNotNull(url, "url");
            Ensure.ArgumentNotNull(refspecs, "refspecs");

            Commands.Fetch(repository, url, refspecs, options, logMessage);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fetch changes from the configured upstream remote and branch into the branch pointed at by HEAD.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="merger">The signature to use for the merge.</param>
        /// <param name="options">The options for fetch and merging.</param>
        public static MergeResult Pull(Repository repository, Signature merger, PullOptions options)
        {
            Ensure.ArgumentNotNull(repository, "repository");
            Ensure.ArgumentNotNull(merger, "merger");


            options = options ?? new PullOptions();
            Branch currentBranch = repository.Head;

            if (!currentBranch.IsTracking)
            {
                throw new LibGit2SharpException("There is no tracking information for the current branch.");
            }

            if (currentBranch.RemoteName == null)
            {
                throw new LibGit2SharpException("No upstream remote for the current branch.");
            }

            Commands.Fetch(repository, currentBranch.RemoteName, new string[0], options.FetchOptions, null);
            return(repository.MergeFetchedRefs(merger, options.MergeOptions));
        }
Ejemplo n.º 5
0
 public void Fetch(IEnumerable <Remote> remotes, CredentialsHandler credentials, IEventStream?eventStream = null, bool prune = false)
 {
     foreach (var remote in remotes)
     {
         Git.Fetch(
             (Repository)repository,
             remote.Name,
             remote.FetchRefSpecs.Select(x => x.Specification), new FetchOptions
         {
             Prune = prune,
             CredentialsProvider = credentials,
             OnProgress          = serverProgressOutput =>
             {
                 eventStream?.Push(new Status(serverProgressOutput));
                 return(true);
             },
             OnTransferProgress = progress =>
             {
                 eventStream?.Push(new Status($"Received {progress.ReceivedObjects} of {progress.TotalObjects}", progress.ReceivedObjects / (float)progress.TotalObjects));
                 return(true);
             }
         }, string.Empty);
     }
 }
Ejemplo n.º 6
0
 public virtual void Fetch(Remote remote, IEnumerable <string> refspecs, string logMessage)
 {
     Commands.Fetch(repository, remote.Name, refspecs, null, logMessage);
 }
Ejemplo n.º 7
0
 public virtual void Fetch(Remote remote, IEnumerable <string> refspecs, FetchOptions options)
 {
     Commands.Fetch(repository, remote.Name, refspecs, options, null);
 }
Ejemplo n.º 8
0
 public virtual void Fetch(Remote remote, FetchOptions options, string logMessage)
 {
     Commands.Fetch(repository, remote.Name, new string[0], options, logMessage);
 }
Ejemplo n.º 9
0
 public virtual void Fetch(Remote remote, string logMessage)
 {
     Commands.Fetch(repository, remote.Name, new string[0], null, logMessage);
 }
Ejemplo n.º 10
0
 public virtual void Fetch(Remote remote, FetchOptions options)
 {
     Commands.Fetch(repository, remote.Name, new string[0], options, null);
 }
Ejemplo n.º 11
0
 public virtual void Fetch(Remote remote)
 {
     Commands.Fetch(repository, remote.Name, new string[0], null, null);
 }