Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="ReflogRecord"/> class.</summary>
        /// <param name="repository">Host repository.</param>
        /// <param name="reflog">Owner reflog.</param>
        /// <param name="revision">Target revision.</param>
        /// <param name="message">Reflog record message.</param>
        /// <param name="index">Reflog record index.</param>
        internal ReflogRecord(Repository repository, Reflog reflog, Revision revision, string message, int index)
            : base(repository)
        {
            Verify.Argument.IsNotNull(reflog, "reflog");
            Verify.Argument.IsNotNull(revision, "revision");
            Verify.Argument.IsNotNull(message, "message");
            Verify.Argument.IsNotNegative(index, "index");

            _reflog   = reflog;
            _revision = revision;
            _message  = message;
            _index    = index;
        }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="ReflogRecord"/> class.</summary>
        /// <param name="repository">Host repository.</param>
        /// <param name="reflog">Owner reflog.</param>
        /// <param name="revision">Target revision.</param>
        /// <param name="message">Reflog record message.</param>
        /// <param name="index">Reflog record index.</param>
        internal ReflogRecord(Repository repository, Reflog reflog, Revision revision, string message, int index)
            : base(repository)
        {
            Verify.Argument.IsNotNull(reflog, nameof(reflog));
            Verify.Argument.IsNotNull(revision, nameof(revision));
            Verify.Argument.IsNotNull(message, nameof(message));
            Verify.Argument.IsNotNegative(index, nameof(index));

            Reflog    = reflog;
            _revision = revision;
            _message  = message;
            _index    = index;
        }
Пример #3
0
        public static ReflogRecord CreateReflogRecord(Reflog reflog, ReflogRecordData reflogRecordData)
        {
            Verify.Argument.IsNotNull(reflog, "reflog");
            Verify.Argument.IsNotNull(reflogRecordData, "reflogRecordData");

            var      repository = reflog.Repository;
            Revision revision;

            lock (repository.Revisions.SyncRoot)
            {
                revision = repository.Revisions.GetOrCreateRevision(reflogRecordData.Revision.SHA1);
            }
            if (!revision.IsLoaded)
            {
                UpdateRevision(revision, reflogRecordData.Revision);
            }
            return(new ReflogRecord(repository, reflog, revision, reflogRecordData.Message, reflogRecordData.Index));
        }