示例#1
0
 static TagCollection CutOutCorrelationId(TagCollection tags)
 {
     // tags.Count > 0
     Assert.Greater(tags.Count, 0);
     Assert.IsTrue(tags.ContainsKey(CorrelationIdName));
     return(TagCollection.FromIEnumerable(tags.Where(_ => _.Key != CorrelationIdName)));
 }
示例#2
0
        public Tag GetMostRecentTagByEnumeration(CommitCollection commits, TagCollection tags)
        {
            Tag recentTag = null;

            foreach (var commit in commits)
            {
                // Commits are actually ordered already in reverse chronological order
                var tag = tags.Where(x => x.Annotation.TargetId.Sha == commit.Sha).FirstOrDefault();

                if (tag != null)
                {
                    recentTag = tag;
                    break;
                }
            }

            return(recentTag);
        }
示例#3
0
        private static void DisplayApi(bool attentionOnly, ApiMetadata api, TagCollection tags, Dictionary <string, DateTimeOffset> shaToTimestamp)
        {
            string tagPrefix = $"{api.Id}-";
            var    releases  = tags
                               .Where(tag => tag.FriendlyName.StartsWith(tagPrefix))
                               .Where(tag => shaToTimestamp.ContainsKey(tag.Target.Sha))
                               .Select(tag => new PackageRelease(api.Id, tag.FriendlyName.Substring(tagPrefix.Length), shaToTimestamp[tag.Target.Sha]))
                               .OrderByDescending(release => release.Timestamp)
                               .ToList();
            var lastGa         = releases.FirstOrDefault(release => release.IsGa);
            var lastPrerelease = releases.FirstOrDefault(release => !release.IsGa);

            if (attentionOnly && !NeedsAttention(api, lastPrerelease, lastGa))
            {
                return;
            }

            Console.WriteLine(api.Id);
            if (lastGa is null && lastPrerelease is null)
            {
                Console.WriteLine("No releases");
            }
示例#4
0
        public Tag GetMostRecentTagByEnumeration(CommitCollection commits, TagCollection tags)
        {
            Tag recentTag = null;

            foreach (var commit in commits)
            {
                // Commits are actually ordered already in reverse chronological order
                var tag = tags.Where(x => x.Annotation.TargetId.Sha == commit.Sha).FirstOrDefault();

                if (tag != null)
                {
                    recentTag = tag;
                    break;
                }
            }

            return recentTag;
        }