MCPcopy Index your code
hub / github.com/angular/angular / collectCommitsAsMap

Function collectCommitsAsMap

scripts/compare-main-to-patch.js:74–99  ·  view source on GitHub ↗

* @param rawGitCommits * @returns {Map } - Map of commit message to [commit info, version]

(rawGitCommits)

Source from the content-addressed store, hash-verified

72 * @returns {Map<string, [string, string]>} - Map of commit message to [commit info, version]
73 */
74function collectCommitsAsMap(rawGitCommits) {
75 const commits = toArray(rawGitCommits);
76 const commitsMap = new Map();
77 let version = initialVersion;
78 commits.reverse().forEach((commit) => {
79 const ignore = shouldIgnoreCommit(commit, ignoreCommitPatterns);
80 // Keep track of the current version while going though the list of commits, so that we can use
81 // this information in the output (i.e. display a version when a commit was introduced).
82 version = maybeExtractReleaseVersion(commit) || version;
83 if (!ignore) {
84 // Extract original commit description from commit message, so that we can find matching
85 // commit in other commit range. For example, for the following commit message:
86 //
87 // 15d3e741e9 feat: update the locale files (#33556)
88 //
89 // we extract only "feat: update the locale files" part and use it as a key, since commit SHA
90 // and PR number may be different for the same commit in main and patch branches.
91 const key = commit
92 .slice(11)
93 .replace(/\(\#\d+\)/g, '')
94 .trim();
95 commitsMap.set(key, [commit, version]);
96 }
97 });
98 return commitsMap;
99}
100
101function getCommitInfoAsString(version, commitInfo) {
102 const formattedVersion = version === initialVersion ? version : `${version}+`;

Callers 1

mainFunction · 0.85

Calls 7

toArrayFunction · 0.85
shouldIgnoreCommitFunction · 0.85
reverseMethod · 0.80
setMethod · 0.65
forEachMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…