Example #1
0
        /// <summary>Push objects and refs from the local repository to the remote one.</summary>
        /// <remarks>
        /// Push objects and refs from the local repository to the remote one.
        /// <p>
        /// This is a utility function providing standard push behavior. It updates
        /// remote refs and send there necessary objects according to remote ref
        /// update specification. After successful remote ref update, associated
        /// locally stored tracking branch is updated if set up accordingly. Detailed
        /// operation result is provided after execution.
        /// <p>
        /// For setting up remote ref update specification from ref spec, see helper
        /// method
        /// <see cref="FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection{E})">FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection&lt;E&gt;)
        /// 	</see>
        /// , predefined refspecs
        /// (
        /// <see cref="REFSPEC_TAGS">REFSPEC_TAGS</see>
        /// ,
        /// <see cref="REFSPEC_PUSH_ALL">REFSPEC_PUSH_ALL</see>
        /// ) or consider using
        /// directly
        /// <see cref="RemoteRefUpdate">RemoteRefUpdate</see>
        /// for more possibilities.
        /// <p>
        /// When
        /// <see cref="IsDryRun()">IsDryRun()</see>
        /// is true, result of this operation is just
        /// estimation of real operation result, no real action is performed.
        /// </remarks>
        /// <seealso cref="RemoteRefUpdate">RemoteRefUpdate</seealso>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use
        /// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
        /// if
        /// progress updates are not interesting or necessary.
        /// </param>
        /// <param name="toPush">
        /// specification of refs to push. May be null or the empty
        /// collection to use the specifications from the RemoteConfig
        /// converted by
        /// <see cref="FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection{E})">FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection&lt;E&gt;)
        /// 	</see>
        /// . No
        /// more than 1 RemoteRefUpdate with the same remoteName is
        /// allowed. These objects are modified during this call.
        /// </param>
        /// <returns>
        /// information about results of remote refs updates, tracking refs
        /// updates and refs advertised by remote repository.
        /// </returns>
        /// <exception cref="System.NotSupportedException">
        /// this transport implementation does not support pushing
        /// objects.
        /// </exception>
        /// <exception cref="NGit.Errors.TransportException">
        /// the remote connection could not be established or object
        /// copying (if necessary) failed at I/O or protocol level or
        /// update specification was incorrect.
        /// </exception>
        public virtual PushResult Push(ProgressMonitor monitor, ICollection<RemoteRefUpdate
			> toPush)
        {
            if (toPush == null || toPush.IsEmpty())
            {
                // If the caller did not ask for anything use the defaults.
                try
                {
                    toPush = FindRemoteRefUpdatesFor(push);
                }
                catch (IOException e)
                {
                    throw new TransportException(MessageFormat.Format(JGitText.Get().problemWithResolvingPushRefSpecsLocally
                        , e.Message), e);
                }
                if (toPush.IsEmpty())
                {
                    throw new TransportException(JGitText.Get().nothingToPush);
                }
            }
            PushProcess pushProcess = new PushProcess(this, toPush);
            return pushProcess.Execute(monitor);
        }
Example #2
0
 /// <exception cref="System.NotSupportedException"></exception>
 /// <exception cref="NGit.Errors.TransportException"></exception>
 private PushResult ExecutePush()
 {
     process = new PushProcess(transport, refUpdates);
     return(process.Execute(new TextProgressMonitor()));
 }
Example #3
0
		/// <exception cref="System.NotSupportedException"></exception>
		/// <exception cref="NGit.Errors.TransportException"></exception>
		private PushResult ExecutePush()
		{
			process = new PushProcess(transport, refUpdates);
			return process.Execute(new TextProgressMonitor());
		}