-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from stan-dev/rstan-submodule-updates
Add update script for rstan submodule
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
trap 'abort' 0 | ||
|
||
set -e | ||
|
||
git checkout develop | ||
git pull origin | ||
git submodule update --init --recursive | ||
pushd StanHeaders/inst/include/upstream > /dev/null | ||
git checkout develop | ||
git pull origin | ||
popd > /dev/null | ||
git submodule update --init --recursive | ||
|
||
original_commit_hash=$(cd StanHeaders/inst/include/upstream && git rev-parse --short HEAD) | ||
stan_commit_hash=$(cd StanHeaders/inst/include/upstream && git rev-parse --short origin/develop) | ||
|
||
|
||
if [ "$original_commit_hash" == "$stan_commit_hash" ]; then | ||
echo "------------------------------------------------------------" | ||
echo "" | ||
echo " No need to update. " | ||
echo " Submodule at: ${original_commit_hash}." | ||
echo " Update to: ${stan_commit_hash}." | ||
echo "" | ||
echo "------------------------------------------------------------" | ||
echo "" | ||
trap : 0 | ||
exit 0 | ||
fi | ||
|
||
pushd StanHeaders/inst/include/upstream > /dev/null | ||
git checkout ${stan_commit_hash} | ||
popd > /dev/null | ||
git add StanHeaders/inst/include/upstream | ||
git commit -m "Updates the Stan submodule to ${stan_commit_hash}." stan | ||
git push origin develop | ||
|
||
trap : 0 | ||
|
||
echo "------------------------------------------------------------" | ||
echo "" | ||
echo " Success updating stan submodule to ${stan_commit_hash}" | ||
echo "" | ||
echo "------------------------------------------------------------" | ||
echo "" | ||
|
||
exit 0 |