()
| 149 | |
| 150 | // Main program |
| 151 | function 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(` |
| 176 | Comparing 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 | |
| 189 | main(); |
no test coverage detected
searching dependent graphs…