aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Newberger <alann@google.com>2014-12-03 10:58:55 -0800
committerAlan Newberger <alann@google.com>2014-12-03 12:56:23 -0800
commit9d4d0643d6c19d79d5035a2b5ab77bc632ba2dda (patch)
treed79c9b551d9834127c52e4388e0de2f05915e37e
parent617200ae32e6671631846ae0f840115c4463c8d4 (diff)
downloadglide-9d4d0643d6c19d79d5035a2b5ab77bc632ba2dda.tar.gz
Fix branch/tag specification in glide update script
Script has master hardwired where it should merge to the specified tag. Various ways to do this but since there is a fetch already, it establishes FETCH_HEAD and I use that for both the merge and the rev-parse, tested and it works. Change-Id: I5a7d8cb4e30808a0bb7192367e1486fb85ec008a
-rwxr-xr-xupdate_files.sh31
1 files changed, 17 insertions, 14 deletions
diff --git a/update_files.sh b/update_files.sh
index 75007997..c6ad4480 100755
--- a/update_files.sh
+++ b/update_files.sh
@@ -1,16 +1,14 @@
#!/bin/bash -e
-# Pulls down the latest version of Glide from the master branch, merges it with
-# the existing version of Glide, and removes unneeded tests, source
+# Pulls down the version of Glide specified by tag/branch, merges it with
+# the existing local version of Glide, and removes unneeded tests, source
# directories, scripts, and build files.
#
-# Make sure ANDROID_BRANCH_NAME matches the current branch name, then:
-#
# Usage: ./update_files.sh [glide_brach_name|glide_tag_name|glide_commit]
#
# WARNING: This script will rm -rf files in the directory in
# which it is run!
-ANDROID_BRANCH_NAME=ub-camera-haleakala
+ANDROID_BRANCH_NAME=$(repo info . | sed -n 's/Current revision: \(.*\)/\1/p')
# Validate that we were given something to checkout from Glide's remote.
if [ $# -ne 1 ]
@@ -35,15 +33,18 @@ git fetch bump ${GLIDE_BRANCH} || exit 1
# submodule.
rm -rf third_party/disklrucache
-# Switch to the branch in Android we want to update and merge.
+# Switch to the branch in Android we want to update, sync and merge.
git checkout ${ANDROID_BRANCH_NAME}
-git merge bump/master || true
+repo sync .
+# FETCH_HEAD defined by the fetch of the tag/branch above
+git merge FETCH_HEAD || true
-# Remove source directories we don't care about.
+# Remove source/build directories we don't care about.
git rm -rf samples || true
git rm -rf integration || true
git rm -rf static || true
git rm -rf glide || true
+git rm -rf .idea || true
# Remove test directories we don't care about.
git rm -rf library/src/androidTest || true
@@ -69,11 +70,13 @@ mv $REMOTE_DISK_PATH third_party/disklrucache
git add third_party/disklrucache
# Remove build/static analysis related files we don't care about.
-find . -name "*gradle*" | xargs git rm -rf
-find . -name "*checkstyle*.xml" | xargs git rm -rf
-find . -name "*pmd*.xml" | xargs git rm -rf
-find . -name "*findbugs*.xml" | xargs git rm -rf
+find . -name "*gradle*" | xargs -r git rm -rf
+find . -name "*checkstyle*.xml" | xargs -r git rm -rf
+find . -name "*pmd*.xml" | xargs -r git rm -rf
+find . -name "*findbugs*.xml" | xargs -r git rm -rf
+find . -name "*.iml" | xargs -r git rm -rf
-GIT_SHA=$(git rev-parse bump/master)
-echo "Merged bump/master at ${GIT_SHA}"
+# FETCH_HEAD defined by the fetch of the tag/branch above
+GIT_SHA=$(git rev-parse FETCH_HEAD)
+echo "Merged bump ${GLIDE_BRANCH} at revision ${GIT_SHA}"
echo "Now fix any merge conflicts, commit, and run: git push goog ${ANDROID_BRANCH_NAME}"