예제 #1
0
        public static GitReleaseNotes SinceVersion(string packageId, string gitRepoPath, int major, int minor = 0, int patch = 0)
        {
            string version = $"{major}.{minor}.{patch}";

            if (!_logCache.ContainsKey(packageId) || !_logCache[packageId].ContainsKey(version))
            {
                lock (_logCacheLock)
                {
                    HashSet <GitLog> logsSinceLast = GitLog.SinceVersion(gitRepoPath, major, minor, patch);
                    GitReleaseNotes  result        = new GitReleaseNotes(version, packageId);
                    logsSinceLast.Each(gl =>
                    {
                        string prefix = $"{packageId}:";
                        if (gl.Subject.StartsWith(prefix))
                        {
                            result.AddBullet(gl.Subject.TruncateFront(prefix.Length), gl.AbbreviatedCommitHash);
                        }
                    });

                    _logCache.AddMissing(packageId, new Dictionary <string, GitReleaseNotes>());
                    _logCache[packageId].AddMissing(version, result);
                }
            }
            return(_logCache[packageId][version]);
        }
예제 #2
0
        public static GitReleaseNotes SinceVersion(string packageId, string gitRepoPath, int major, int minor, int patch)
        {
            string           sinceVersion     = $"v{major}.{minor}.{patch}";
            HashSet <GitLog> logsSinceVersion = GitLog.SinceVersion(gitRepoPath, major, minor, patch, false);
            GitReleaseNotes  notes            = new GitReleaseNotes(sinceVersion, packageId);

            foreach (GitLog log in logsSinceVersion)
            {
                string prefix = $"{packageId}:";
                if (log.Subject.StartsWith(prefix))
                {
                    notes.AddBullet(log.Subject.TruncateFront(prefix.Length), log.AbbreviatedCommitHash);
                }
            }
            return(notes);
        }
예제 #3
0
        public static GitReleaseNotes SinceLatestRelease(string packageId, string gitRepoPath, out string latestRelease)
        {
            latestRelease = Git.LatestRelease(gitRepoPath);
            HashSet <GitLog> logsSinceLast = GitLog.SinceLatestRelease(gitRepoPath);
            GitReleaseNotes  notes         = new GitReleaseNotes(latestRelease, packageId);

            foreach (GitLog log in logsSinceLast)
            {
                string prefix = $"{packageId}:";
                if (log.Subject.StartsWith(prefix))
                {
                    notes.AddBullet(log.Subject.TruncateFront(prefix.Length), log.AbbreviatedCommitHash);
                }
            }
            return(notes);
        }
예제 #4
0
        public static GitReleaseNotes MiscSinceLatestRelease(string gitRepoPath)
        {
            string           version       = Git.LatestRelease(gitRepoPath);
            HashSet <GitLog> logsSinceLast = GitLog.SinceLatestRelease(gitRepoPath);

            GitReleaseNotes result = new GitReleaseNotes(version);

            logsSinceLast.Each(gl =>
            {
                if (!HasPossibleProjectPrefix(gl.Subject))
                {
                    result.AddBullet(gl.Subject, gl.AbbreviatedCommitHash);
                }
            });

            return(result);
        }
예제 #5
0
        public static GitReleaseNotes MiscSinceVersion(string gitRepoPath, int major, int minor, int patch = 0)
        {
            string           version       = $"{major}.{minor}.{patch}";
            HashSet <GitLog> logsSinceLast = GitLog.SinceVersion(gitRepoPath, major, minor, patch);

            if (!_logCache.ContainsKey("Misc") || !_logCache["Misc"].ContainsKey(version))
            {
                lock (_logCacheLock)
                {
                    GitReleaseNotes result = new GitReleaseNotes(version);
                    logsSinceLast.Each(gl =>
                    {
                        if (!HasPossibleProjectPrefix(gl.Subject))
                        {
                            result.AddBullet(gl.Subject, gl.AbbreviatedCommitHash);
                        }
                    });
                    _logCache.AddMissing("Misc", new Dictionary <string, GitReleaseNotes>());
                    _logCache["Misc"].AddMissing(version, result);
                }
            }
            return(_logCache["Misc"][version]);
        }