execute() public method

Perform push operation between local and remote repository - set remote refs appropriately, send needed objects and update local tracking refs. When Transport.DryRun is true, result of this operation is just estimation of real operation result, no real action is performed.
/// When push operation is not supported by provided transport. /// /// When some error occurred during operation, like I/O, protocol /// error, or local database consistency error. ///
public execute ( ProgressMonitor monitor ) : PushResult
monitor ProgressMonitor /// Progress monitor used for feedback about operation. ///
return PushResult
Beispiel #1
0
        public PushResult push(ProgressMonitor monitor, ICollection <RemoteRefUpdate> toPush)
        {
            if (toPush == null || toPush.Count == 0)
            {
                try
                {
                    toPush = findRemoteRefUpdatesFor(_pushSpecs);
                }
                catch (IOException e)
                {
                    throw new TransportException("Problem with resolving push ref specs locally: " + e.Message, e);
                }

                if (toPush.Count == 0)
                {
                    throw new TransportException("Nothing to push");
                }
            }

            var pushProcess = new PushProcess(this, toPush);

            return(pushProcess.execute(monitor));
        }
Beispiel #2
0
        /// <summary>
        /// Push objects and refs from the local repository to the remote one.
        /// <para/>
        /// 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.
        /// <para/>
        /// For setting up remote ref update specification from ref spec, see helper
        /// method <see cref="findRemoteRefUpdatesFor(System.Collections.Generic.List{GitSharp.Core.Transport.RefSpec})"/>, predefined refspecs
        /// (<see cref="REFSPEC_TAGS"/>, <see cref="REFSPEC_PUSH_ALL"/>) or consider using
        /// directly <see cref="RemoteRefUpdate"/> for more possibilities.
        /// <para/>
        /// When <see cref="get_DryRun"/> is true, result of this operation is just
        /// estimation of real operation result, no real action is performed.
        /// </summary>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use <see cref="NullProgressMonitor"/> 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.List{GitSharp.Core.Transport.RefSpec})"/>. 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>
        public 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("Problem with resolving push ref specs locally: " + e.Message, e);
                }

                if (toPush.isEmpty())
                {
                    throw new TransportException("Nothing to push");
                }
            }

            var pushProcess = new PushProcess(this, toPush);

            return(pushProcess.execute(monitor));
        }
Beispiel #3
0
        public PushResult push(ProgressMonitor monitor, ICollection<RemoteRefUpdate> toPush)
        {
            if (toPush == null || toPush.Count == 0)
            {
                try
                {
                    toPush = findRemoteRefUpdatesFor(_pushSpecs);
                }
                catch (IOException e)
                {
                    throw new TransportException("Problem with resolving push ref specs locally: " + e.Message, e);
                }

                if (toPush.Count == 0)
                {
                    throw new TransportException("Nothing to push");
                }
            }

            var pushProcess = new PushProcess(this, toPush);
            return pushProcess.execute(monitor);
        }
Beispiel #4
0
 private PushResult executePush()
 {
     process = new PushProcess(transport, refUpdates);
     return process.execute(new TextProgressMonitor());
 }
Beispiel #5
0
        /// <summary>
        /// Push objects and refs from the local repository to the remote one.
        /// <para/>
        /// 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.
        /// <para/>
        /// For setting up remote ref update specification from ref spec, see helper
        /// method <see cref="findRemoteRefUpdatesFor(System.Collections.Generic.List{GitSharp.Core.Transport.RefSpec})"/>, predefined refspecs
        /// (<see cref="REFSPEC_TAGS"/>, <see cref="REFSPEC_PUSH_ALL"/>) or consider using
        /// directly <see cref="RemoteRefUpdate"/> for more possibilities.
        /// <para/>
        /// When <see cref="get_DryRun"/> is true, result of this operation is just
        /// estimation of real operation result, no real action is performed.
        /// </summary>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use <see cref="NullProgressMonitor"/> 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.List{GitSharp.Core.Transport.RefSpec})"/>. 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>
        public 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("Problem with resolving push ref specs locally: " + e.Message, e);
                }

                if (toPush.isEmpty())
                {
                    throw new TransportException("Nothing to push");
                }
            }

            var pushProcess = new PushProcess(this, toPush);
            return pushProcess.execute(monitor);
        }