@@ -81,6 +81,11 @@ export function changelogDefine( yargs ) {
81
81
describe :
82
82
'Never ask whether affected plugins without direct changes should have change entries added.' ,
83
83
type : 'boolean' ,
84
+ } )
85
+ . option ( 'base-ref' , {
86
+ describe : 'Git ref to compare to.' ,
87
+ type : 'string' ,
88
+ default : 'origin/trunk' ,
84
89
} ) ;
85
90
} ,
86
91
async argv => {
@@ -321,7 +326,7 @@ async function changelogAdd( argv ) {
321
326
322
327
// If we weren't passed a project, check if any projects need changelogs.
323
328
if ( argv . _ [ 1 ] === 'add' && ! argv . project ) {
324
- changelogInfo = await checkChangelogFiles ( ) ;
329
+ changelogInfo = await checkChangelogFiles ( argv . baseRef ) ;
325
330
needChangelog = changelogInfo . need ;
326
331
}
327
332
if ( needChangelog . length === 0 ) {
@@ -336,7 +341,7 @@ async function changelogAdd( argv ) {
336
341
}
337
342
338
343
if ( argv . checkIndirectPlugins ?? needChangelog . length > 0 ) {
339
- changelogInfo ??= await checkChangelogFiles ( ) ;
344
+ changelogInfo ??= await checkChangelogFiles ( argv . baseRef ) ;
340
345
await addIndirectPlugins (
341
346
argv ,
342
347
argv . checkIndirectPlugins ? changelogInfo . touched : needChangelog ,
@@ -531,6 +536,8 @@ async function changelogArgs( argv ) {
531
536
...projectTypes ,
532
537
'--check-indirect-plugins' ,
533
538
'--no-check-indirect-plugins' ,
539
+ '--base-ref' ,
540
+ '--base-ref=' + argv . baseRef ,
534
541
] ;
535
542
let file ;
536
543
@@ -682,12 +689,13 @@ async function gitAdd( argv ) {
682
689
/**
683
690
* Checks if changelog files are required.
684
691
*
692
+ * @param {string } baseRef - Git reference to compare with.
685
693
* @return {object } as follows:
686
694
* - {string[]} touched - Touched projects.
687
695
* - {Map<string,string[]>} files - Change files by project.
688
696
* - {string[]} need - Projects needing changelogs.
689
697
*/
690
- async function checkChangelogFiles ( ) {
698
+ async function checkChangelogFiles ( baseRef ) {
691
699
console . log ( chalk . green ( 'Checking if changelog files are needed. Just a sec...' ) ) ;
692
700
693
701
// Bail if we're pushing to a release branch, like boost/branch-1.3.0
@@ -714,7 +722,7 @@ async function checkChangelogFiles() {
714
722
`--no-renames` ,
715
723
`--name-only` ,
716
724
`--merge-base` ,
717
- `origin/trunk` ,
725
+ baseRef ,
718
726
] ) ;
719
727
touchedFiles = touchedFiles . stdout . toString ( ) . trim ( ) . split ( '\n' ) ;
720
728
0 commit comments