From 17f47ee2cb2a42adbd6ab55c67e820caf956154a Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 16 Oct 2019 11:29:54 -0600 Subject: [PATCH] Make git-sync-master as well as git-sync-develop --- gulpfile.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 32fe0cfef..93e9ed9ab 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -771,15 +771,25 @@ gulp.task('release', gulp.series(['build', 'typings', function() { // The default task builds Blockly. gulp.task('default', gulp.series(['build'])); + +// Stash current state, check out the named branch, and sync with +// google/blockly. +function syncBranch(branchName) { + return function(done) { + execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' }); + execSync('git checkout ' + branchName, { stdio: 'inherit' }); + execSync('git pull https://github.com/google/blockly.git ' + branchName, + { stdio: 'inherit' }); + execSync('git push origin ' + branchName, { stdio: 'inherit' }); + done(); + } +} + // Stash current state, check out develop, and sync with google/blockly. -gulp.task('git-sync-develop', function(done) { - execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' }); - execSync('git checkout develop', { stdio: 'inherit' }); - execSync('git pull https://github.com/google/blockly.git develop', - { stdio: 'inherit' }); - execSync('git push origin develop', { stdio: 'inherit' }); - done(); -}); +gulp.task('git-sync-develop', syncBranch('develop')); + +// Stash current state, check out master, and sync with google/blockly. +gulp.task('git-sync-master', syncBranch('master')); // Helper function: get a name for a rebuild branch. Format: rebuild_mm_dd_yyyy. function getRebuildBranchName() {