From cb3e75ae98d2f292178a44a053bd368993b361d0 Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Sun, 6 Jan 2019 15:56:56 +1100 Subject: [PATCH] Add autosync.sh --- .travis/common-exclusion.list | 2 +- autosync.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 autosync.sh diff --git a/.travis/common-exclusion.list b/.travis/common-exclusion.list index 9bf9f92d4..aca915c52 100644 --- a/.travis/common-exclusion.list +++ b/.travis/common-exclusion.list @@ -6,4 +6,4 @@ appveyor.yml setup_win.bat qb64/internal/c/mingw32 qb64/internal/c/mingw64 - +autosync.sh diff --git a/autosync.sh b/autosync.sh new file mode 100644 index 000000000..e2c624efc --- /dev/null +++ b/autosync.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# This script reproduces any commits on upstream to the given remotes, but only on the given branches. +# It is intended to be run via a cron job or similar. +# The merge is --ff-only, so the target branches must not have anything else adding commits to them. + +set -e +cd ~/qb64 + +# Adding a new branch/remote? git checkout -b $remote-$branch $remote/$branch to create a new local. +BRANCHES='development' +REMOTES='origin fellippe qb64team' + +git fetch upstream + +for branch in $BRANCHES; do + for remote in $REMOTES; do + git checkout -q $remote-$branch + git merge -q --ff-only upstream/$branch + done +done + +for remote in $REMOTES; do + refspecs= + for branch in $BRANCHES; do + refspecs="$refspecs $remote-$branch:$branch" + done + git push -q $remote $refspecs +done