Skip to content

Commit

Permalink
Extend gitsync to mirror specific branches. (#1016)
Browse files Browse the repository at this point in the history
Tulsi is now published to an 'upstream' branch, not 'master'. This PR extends the gitsync script to support mirroring non-master branches.
  • Loading branch information
jin authored Aug 10, 2020
1 parent 8f41b25 commit e01ed36
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions gitsync/gitsync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# where
# direction can be ==> or <=>
REPOSITORIES=(
"https://bazel.googlesource.com/bazel ==> git@github.com:bazelbuild/bazel.git bazel"
"https://bazel.googlesource.com/tulsi ==> git@github.com:bazelbuild/tulsi.git tulsi"
"https://bazel.googlesource.com/bazel ==> git@github.com:bazelbuild/bazel.git bazel master"
"https://bazel.googlesource.com/tulsi ==> git@github.com:bazelbuild/tulsi.git tulsi upstream"
)

set -euxo pipefail
Expand Down Expand Up @@ -57,16 +57,17 @@ function sync() {
local direction="$2"
local destination="$3"
local name="$4"
local branch="$5"

pushd "${name}"
echo "Syncing ${origin} ${direction} ${destination} ..."
echo "Syncing ${origin} ${direction} ${destination} on the $branch branch..."
git remote update --prune
git checkout "origin/master" -B "master"
git checkout "origin/$branch" -B "$branch"
if [[ "${direction}" == "<=>" ]]; then
git rebase "destination/master"
git push -f origin master
git rebase "destination/$branch"
git push -f origin "$branch"
fi
git push destination master
git push destination "$branch"
popd
}

Expand Down

0 comments on commit e01ed36

Please sign in to comment.