Add a --just-print flag to roll_dev. (#14766)

This will allow other tools to call into the roll_dev script
to know what version is about to be published without actually
publishing.
This commit is contained in:
Todd Volkert
2018-02-18 22:27:46 -08:00
committed by GitHub
parent 1e242ebc7c
commit 1363489a86

View File

@@ -17,6 +17,7 @@ const String kY = 'y';
const String kZ = 'z';
const String kCommit = 'commit';
const String kOrigin = 'origin';
const String kJustPrint = 'just-print';
const String kYes = 'yes';
const String kHelp = 'help';
@@ -47,6 +48,13 @@ void main(List<String> args) {
valueHelp: 'repository',
defaultsTo: 'upstream',
);
argParser.addFlag(
kJustPrint,
negatable: false,
help:
'Don\'t actually roll the dev channel; '
'just print the would-be version and quit.',
);
argParser.addFlag(kYes, negatable: false, abbr: 'y', help: 'Skip the confirmation prompt.');
argParser.addFlag(kHelp, negatable: false, help: 'Show this help message.', hide: true);
ArgResults argResults;
@@ -61,6 +69,7 @@ void main(List<String> args) {
final String level = argResults[kIncrement];
final String commit = argResults[kCommit];
final String origin = argResults[kOrigin];
final bool justPrint = argResults[kJustPrint];
final bool autoApprove = argResults[kYes];
final bool help = argResults[kHelp];
@@ -122,6 +131,11 @@ void main(List<String> args) {
}
version = parts.join('.');
if (justPrint) {
print(version);
exit(0);
}
final String hash = getGitOutput('rev-parse HEAD', 'Get git hash for $commit');
runGit('tag v$version', 'tag the commit with the version label');