Beispiel #1
0
 public GitCommit(GitId id, string commitMessage, DateTime date, GitAuthor author)
 {
     Id            = id;
     CommitMessage = commitMessage ?? throw new ArgumentNullException(nameof(commitMessage));
     Date          = date;
     Author        = author ?? throw new ArgumentNullException(nameof(author));
 }
Beispiel #2
0
        public GitTag(string name, GitId commit)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Value must not be null or whitespace", nameof(name));
            }

            Name   = name;
            Commit = commit;
        }
Beispiel #3
0
        public GitCommit(GitId id, string commitMessage, DateTime date, GitAuthor author)
        {
            if (id.IsNull)
            {
                throw new ArgumentException("Commit id must not be empty", nameof(id));
            }

            Id            = id;
            CommitMessage = commitMessage ?? throw new ArgumentNullException(nameof(commitMessage));
            Date          = date;
            Author        = author ?? throw new ArgumentNullException(nameof(author));
        }
Beispiel #4
0
        /// <inheritdoc />
        public IReadOnlyList <GitNote> GetNotes(GitId id)
        {
            var gitObject = m_Repository.Lookup <GitObject>(id.Id);

            if (gitObject is null)
            {
                throw new GitObjectNotFoundException($"Git object '{id}' was not found. Cannot retrieve notes for object.");
            }

            return(m_Repository.Notes[gitObject.Id]
                   .Select(ToGitNote)
                   .ToList());
        }
Beispiel #5
0
        public GitNote(GitId target, string @namespace, string message)
        {
            if (target.IsNull)
            {
                throw new ArgumentException("Object id must not be empty", nameof(target));
            }

            if (String.IsNullOrWhiteSpace(@namespace))
            {
                throw new ArgumentException("Value must not be null or whitespace", nameof(@namespace));
            }

            Target    = target;
            Namespace = @namespace;
            Message   = message ?? throw new ArgumentNullException(nameof(message));
        }
Beispiel #6
0
        /// <inheritdoc />
        public IReadOnlyList <GitCommit> GetCommits(GitId?fromCommit, GitId toCommit)
        {
            // Set up commit filter
            var filter = new CommitFilter()
            {
                IncludeReachableFrom = toCommit.Id
            };

            if (fromCommit.HasValue)
            {
                filter.ExcludeReachableFrom = fromCommit.Value.Id;
            }

            return(m_Repository.Commits.QueryBy(filter)
                   .Select(ToGitCommit)
                   .ToList());
        }