Example #1
0
        /// <summary>Create a new RefUpdate copying the batch settings.</summary>
        /// <remarks>Create a new RefUpdate copying the batch settings.</remarks>
        /// <param name="cmd">specific command the update should be created to copy.</param>
        /// <returns>a single reference update command.</returns>
        /// <exception cref="System.IO.IOException">
        /// the reference database cannot make a new update object for
        /// the given reference.
        /// </exception>
        protected internal virtual RefUpdate NewUpdate(ReceiveCommand cmd)
        {
            RefUpdate ru = refdb.NewUpdate(cmd.GetRefName(), false);

            if (IsRefLogDisabled())
            {
                ru.DisableRefLog();
            }
            else
            {
                ru.SetRefLogIdent(refLogIdent);
                ru.SetRefLogMessage(refLogMessage, refLogIncludeResult);
            }
            switch (cmd.GetType())
            {
            case ReceiveCommand.Type.DELETE:
            {
                if (!ObjectId.ZeroId.Equals(cmd.GetOldId()))
                {
                    ru.SetExpectedOldObjectId(cmd.GetOldId());
                }
                ru.SetForceUpdate(true);
                return(ru);
            }

            case ReceiveCommand.Type.CREATE:
            case ReceiveCommand.Type.UPDATE:
            case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
            default:
            {
                ru.SetForceUpdate(IsAllowNonFastForwards());
                ru.SetExpectedOldObjectId(cmd.GetOldId());
                ru.SetNewObjectId(cmd.GetNewId());
                return(ru);

                break;
            }
            }
        }
Example #2
0
 /// <summary>Set the identity of the user appearing in the reflog.</summary>
 /// <remarks>
 /// Set the identity of the user appearing in the reflog.
 /// <p>
 /// The timestamp portion of the identity is ignored. A new identity with the
 /// current timestamp will be created automatically when the rename occurs
 /// and the log record is written.
 /// </remarks>
 /// <param name="pi">
 /// identity of the user. If null the identity will be
 /// automatically determined based on the repository
 /// configuration.
 /// </param>
 public virtual void SetRefLogIdent(PersonIdent pi)
 {
     destination.SetRefLogIdent(pi);
 }