| 1 |
# -------------------------------------------------------------------------- |
| 2 |
# --- Pulling Dome Updates |
| 3 |
# -------------------------------------------------------------------------- |
| 4 |
|
| 5 |
branch=$1 |
| 6 |
app=$(basename $1) |
| 7 |
|
| 8 |
if [ "$branch" == "" ] |
| 9 |
then |
| 10 |
echo "Missing branch name, aborted." |
| 11 |
exit 1 |
| 12 |
fi |
| 13 |
|
| 14 |
if [ ! -z "$(git status --porcelain)" ] |
| 15 |
then |
| 16 |
echo "Local non-commited modifications, aborted." |
| 17 |
exit 1 |
| 18 |
fi |
| 19 |
|
| 20 |
if [ ! -d .gitdome ] |
| 21 |
then |
| 22 |
git clone [email protected]:dome/electron.git .gitdome |
| 23 |
fi |
| 24 |
|
| 25 |
head=$(git rev-parse --abbrev-ref HEAD) |
| 26 |
commit=$(git rev-parse HEAD) |
| 27 |
remote=$(git -C .gitdome rev-parse --abbrev-ref HEAD) |
| 28 |
|
| 29 |
echo "[dome] update $branch" |
| 30 |
git -C .gitdome fetch --prune |
| 31 |
git -C .gitdome checkout $branch |
| 32 |
|
| 33 |
if [ "$?" != "0" ] |
| 34 |
then |
| 35 |
git -C .gitdome checkout -b $branch |
| 36 |
else |
| 37 |
git -C .gitdome pull --rebase |
| 38 |
fi |
| 39 |
|
| 40 |
echo "[dome] push updates from $head to $branch..." |
| 41 |
|
| 42 |
for f in $(git ls-files) |
| 43 |
do |
| 44 |
mkdir -p .gitdome/$(dirname $f) |
| 45 |
cp -f $f .gitdome/$f |
| 46 |
git -C .gitdome add $f |
| 47 |
done |
| 48 |
|
| 49 |
echo "[dome] commit $branch" |
| 50 |
git -C .gitdome commit -e -m "[$app] $commit" |
| 51 |
echo "[dome] push $branch" |
| 52 |
git -C .gitdome push origin -f -u $branch |
| 53 |
echo "[dome] back to $remote" |
| 54 |
git -C .gitdome checkout $remote |
| 55 |
|
| 56 |
# -------------------------------------------------------------------------- |