Пример #1
0
 public SemVer(SemVer lastSemVer, int commitsSince)
 {
     _major        = lastSemVer.Major;
     _minor        = lastSemVer.Minor;
     _patch        = commitsSince > 0 ? lastSemVer.Patch + 1 : lastSemVer.Patch;
     _commitsSince = commitsSince;
 }
Пример #2
0
 public SemVer(SemVer lastSemVer, int commitsSince)
 {
     _major = lastSemVer.Major;
       _minor = lastSemVer.Minor;
       _patch = commitsSince > 0 ? lastSemVer.Patch + 1 : lastSemVer.Patch;
       _commitsSince = commitsSince;
 }
Пример #3
0
        protected override void EndProcessing()
        {
            using (var repository = new Repository(_directory))
              {
            SemVer semVer;

            var lastSemVerTag = GetLastSemVerTag(repository);
            if (lastSemVerTag == null)
            {
              semVer = new SemVer(new SemVer(0, 0, 0), repository.Commits.Count());
            }
            else
            {
              var commitsSinceTag = repository.Head.Commits.TakeWhile(x => x != lastSemVerTag.Item1.Target).Count();
              semVer = new SemVer(lastSemVerTag.Item2, commitsSinceTag);
            }

            WriteObject(new VersionInformation(repository.Head.Name, repository.Head.Tip.Sha, semVer));
              }
        }
Пример #4
0
        protected override void EndProcessing()
        {
            using (var repository = new Repository(_directory))
            {
                SemVer semVer;

                var lastSemVerTag = GetLastSemVerTag(repository);
                if (lastSemVerTag == null)
                {
                    semVer = new SemVer(new SemVer(0, 0, 0), repository.Commits.Count());
                }
                else
                {
                    var commitsSinceTag = repository.Head.Commits.TakeWhile(x => x != lastSemVerTag.Item1.Target).Count();
                    semVer = new SemVer(lastSemVerTag.Item2, commitsSinceTag);
                }

                WriteObject(new VersionInformation(repository.Head.Name, repository.Head.Tip.Sha, semVer));
            }
        }
Пример #5
0
 public VersionInformation(string branch, string commit, SemVer semVer)
 {
     _branch = branch;
     _commit = commit;
     _semVer = semVer;
 }
Пример #6
0
 public VersionInformation(string branch, string commit, SemVer semVer)
 {
     _branch = branch;
       _commit = commit;
       _semVer = semVer;
 }
Пример #7
0
        private Tuple <Tag, SemVer> GetLastSemVerTag(IRepository repository)
        {
            var relatedTags = repository.Head.Commits.SelectMany(x => repository.Tags.Where(y => y.Target == x)).ToList();

            return(relatedTags.Select(x => Tuple.Create(x, SemVer.TryParse(x.Name))).FirstOrDefault(x => x.Item2 != null));
        }