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

Function main

scripts/compare-main-to-patch.js:151–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149
150// Main program
151function main() {
152 execGitCommand('git fetch upstream');
153
154 // Extract tags information and pick the most recent version
155 // that we'll use later to compare with main.
156 const tags = toArray(execGitCommand('git tag'));
157 const latestTag = getLatestTag(tags);
158
159 // Based on the latest tag, generate the name of the patch branch.
160 const branch = getBranchByTag(latestTag);
161
162 // Extract main-only and patch-only commits using `git log` command.
163 const mainCommits = execGitCommand(
164 `git log --cherry-pick --oneline --right-only upstream/${branch}...upstream/main`,
165 );
166 const patchCommits = execGitCommand(
167 `git log --cherry-pick --oneline --left-only upstream/${branch}...upstream/main`,
168 );
169
170 // Post-process commits and convert raw data into a Map, so that we can diff it easier.
171 const mainCommitsMap = collectCommitsAsMap(mainCommits);
172 const patchCommitsMap = collectCommitsAsMap(patchCommits);
173
174 // tslint:disable-next-line:no-console
175 console.log(`
176Comparing branches "${branch}" and main.
177
178***** Only in MAIN *****
179${diff(mainCommitsMap, patchCommitsMap).join('\n') || 'No extra commits'}
180
181***** Only in PATCH (${branch}) *****
182${diff(patchCommitsMap, mainCommitsMap).join('\n') || 'No extra commits'}
183
184***** Features in PATCH (${branch}) - should always be empty *****
185${listFeatures(patchCommitsMap).join('\n') || 'No extra commits'}
186`);
187}
188
189main();

Callers 1

Calls 9

execGitCommandFunction · 0.85
toArrayFunction · 0.85
getLatestTagFunction · 0.85
getBranchByTagFunction · 0.85
collectCommitsAsMapFunction · 0.85
listFeaturesFunction · 0.85
diffFunction · 0.70
logMethod · 0.65
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…