This repository has been archived by the owner on Feb 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync-to-open-source-repo.sh
executable file
·55 lines (45 loc) · 1.72 KB
/
sync-to-open-source-repo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Copyright (c) 2021-present, Cruise LLC
#
# This source code is licensed under the Apache License, Version 2.0,
# found in the LICENSE-APACHE file in the root directory of this source tree.
# You may not use this file except in compliance with the License.
set -euo pipefail
# Per https://stackoverflow.com/a/16349776
cd "${0%/*}/.."
TEMP_REPO=__temp-open-source-wrflib__
# Some sanity checks.
if [[ $(git rev-parse --abbrev-ref HEAD) != "master" ]]; then
read -p "Not on 'master' branch, continue? (y/N) " choice
case "$choice" in
y|Y ) echo "Continuing...";;
* ) exit;;
esac
fi
if [[ -n $(git status --porcelain) ]]; then
read -p "Git tree is dirty, continue? (y/N) " choice
case "$choice" in
y|Y ) echo "Continuing...";;
* ) exit;;
esac
fi
# Remove potential existing directory (after unclean script exit).
rm -rf $TEMP_REPO
# Clone open source repo into new directory.
git clone [email protected]:cruise-automation/webviz-rust-framework.git $TEMP_REPO
# Sync up files.
rsync -av --delete --exclude .git --exclude target/ --exclude 'cef_binary_*' --exclude node_modules/ wrflib_open_source_root/ $TEMP_REPO/
rsync -av --delete --exclude .git --exclude target/ --exclude 'cef_binary_*' --exclude node_modules/ wrflib/ $TEMP_REPO/wrflib/
rsync -av rustfmt.toml $TEMP_REPO/rustfmt.toml
pushd $TEMP_REPO
# Create a new branch (actually for now let's just commit directly to master)
# git checkout -b update-$(date +%s)
# Add everything.
git add .
# Commit! This should bring up an interactive editor so the user can write a commit message.
git commit --verbose --template <(printf "Update from internal repo\n\nChangelog:\n-")
# Push the new branch.
git push --all -u
popd
# Clean up.
rm -rf $TEMP_REPO