Unverified Commit 556a33a3 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Allow upstream repo name to be configurable in roll-dev.dart (#14608)

parent a194818c
...@@ -16,6 +16,8 @@ const String kX = 'x'; ...@@ -16,6 +16,8 @@ const String kX = 'x';
const String kY = 'y'; const String kY = 'y';
const String kZ = 'z'; const String kZ = 'z';
const String kCommit = 'commit'; const String kCommit = 'commit';
const String kOrigin = 'origin';
const String kYes = 'yes';
const String kHelp = 'help'; const String kHelp = 'help';
const String kUpstreamRemote = 'git@github.com:flutter/flutter.git'; const String kUpstreamRemote = 'git@github.com:flutter/flutter.git';
...@@ -39,6 +41,13 @@ void main(List<String> args) { ...@@ -39,6 +41,13 @@ void main(List<String> args) {
valueHelp: 'hash', valueHelp: 'hash',
defaultsTo: 'upstream/master', defaultsTo: 'upstream/master',
); );
argParser.addOption(
kOrigin,
help: 'Specifies the name of the upstream repository',
valueHelp: 'repository',
defaultsTo: 'upstream',
);
argParser.addFlag(kYes, negatable: false, abbr: 'y', help: 'Skip the confirmation prompt.');
argParser.addFlag(kHelp, negatable: false, help: 'Show this help message.', hide: true); argParser.addFlag(kHelp, negatable: false, help: 'Show this help message.', hide: true);
ArgResults argResults; ArgResults argResults;
try { try {
...@@ -50,7 +59,9 @@ void main(List<String> args) { ...@@ -50,7 +59,9 @@ void main(List<String> args) {
} }
final String level = argResults[kIncrement]; final String level = argResults[kIncrement];
final bool commit = argResults[kCommit]; final String commit = argResults[kCommit];
final String origin = argResults[kOrigin];
final bool autoApprove = argResults[kYes];
final bool help = argResults[kHelp]; final bool help = argResults[kHelp];
if (help || level == null) { if (help || level == null) {
...@@ -59,7 +70,7 @@ void main(List<String> args) { ...@@ -59,7 +70,7 @@ void main(List<String> args) {
exit(0); exit(0);
} }
if (getGitOutput('remote get-url upstream', 'check whether this is a flutter checkout') != kUpstreamRemote) { if (getGitOutput('remote get-url $origin', 'check whether this is a flutter checkout') != kUpstreamRemote) {
print('The current directory is not a Flutter repository checkout with a correctly configured upstream remote.'); print('The current directory is not a Flutter repository checkout with a correctly configured upstream remote.');
print('For more details see: https://github.com/flutter/flutter/wiki/Release-process'); print('For more details see: https://github.com/flutter/flutter/wiki/Release-process');
exit(1); exit(1);
...@@ -73,7 +84,7 @@ void main(List<String> args) { ...@@ -73,7 +84,7 @@ void main(List<String> args) {
exit(1); exit(1);
} }
runGit('fetch upstream', 'fetch upstream'); runGit('fetch $origin', 'fetch $origin');
runGit('reset $commit --hard', 'check out master branch'); runGit('reset $commit --hard', 'check out master branch');
String version = getFullTag(); String version = getFullTag();
...@@ -117,17 +128,21 @@ void main(List<String> args) { ...@@ -117,17 +128,21 @@ void main(List<String> args) {
// PROMPT // PROMPT
print('Your tree is ready to publish Flutter $version (${hash.substring(0, 10)}) ' if (autoApprove) {
'to the "dev" channel.'); print('Publishing Flutter $version (${hash.substring(0, 10)}) to the "dev" channel.');
stdout.write('Are you? [yes/no] '); } else {
if (stdin.readLineSync() != 'yes') { print('Your tree is ready to publish Flutter $version (${hash.substring(0, 10)}) '
runGit('tag -d v$version', 'remove the tag you did not want to publish'); 'to the "dev" channel.');
print('The dev roll has been aborted.'); stdout.write('Are you? [yes/no] ');
exit(0); if (stdin.readLineSync() != 'yes') {
runGit('tag -d v$version', 'remove the tag you did not want to publish');
print('The dev roll has been aborted.');
exit(0);
}
} }
runGit('push upstream v$version', 'publish the version'); runGit('push $origin v$version', 'publish the version');
runGit('push upstream HEAD:dev', 'land the new version on the "dev" branch'); runGit('push $origin HEAD:dev', 'land the new version on the "dev" branch');
print('Flutter version $version has been rolled to the "dev" channel!'); print('Flutter version $version has been rolled to the "dev" channel!');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment