summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-01-05 14:18:03 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-01-05 14:44:38 +0100
commitf4ce3e600c5f52b07bbf25304694149c262d023a (patch)
tree1064894f9fc47eade785d5b29c74c3674d813a85 /bin
parent66ed8d0f354d29f44135b817061e8e65f7d4f1c7 (diff)
Added helper script for easier V8 updates
It won't take away the pain of resolving conflicts, but it'll hide the git magic from you :) Change-Id: I6901ca8edb8263ea733a3d4b94393a06e8f25731 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-v8.sh94
1 files changed, 94 insertions, 0 deletions
diff --git a/bin/update-v8.sh b/bin/update-v8.sh
new file mode 100755
index 0000000..d6f7826
--- /dev/null
+++ b/bin/update-v8.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+die() {
+ echo $*
+ exit 1
+}
+
+if [ $# -eq 2 ]; then
+ repository=$1
+ tag=$2
+else
+ die "usage: $0 [url] [commit]"
+fi
+
+require_clean_work_tree() {
+ # test if working tree is dirty
+ git rev-parse --verify HEAD > /dev/null &&
+ git update-index --refresh &&
+ git diff-files --quiet &&
+ git diff-index --cached --quiet HEAD ||
+ die "Working tree is dirty"
+}
+
+test -z "$(git rev-parse --show-cdup)" || {
+ exit=$?
+ echo >&2 "You need to run this command from the toplevel of the working tree."
+ exit $exit
+}
+
+echo "checking working tree"
+require_clean_work_tree
+
+echo "fetching"
+git fetch $repository $tag
+if [ $? != 0 ]; then
+ die "git fetch failed"
+fi
+
+rev=`git rev-parse FETCH_HEAD`
+
+srcdir=src/3rdparty/v8
+absSrcDir=$PWD/$srcdir
+localDiff=
+
+echo "replacing $srcdir"
+if [ -d $srcdir ]; then
+ git ls-files $srcdir | xargs rm
+ git ls-files -z $srcdir | git update-index --force-remove -z --stdin
+ lastImport=`git rev-list --max-count=1 HEAD -- $srcdir/ChangeLog`
+ changes=`git rev-list --no-merges --reverse $lastImport.. -- $srcdir`
+ localDiff=/tmp/v8_patch
+ echo -n>$localDiff
+ for change in $changes; do
+ echo "Saving commit $change"
+ git show -p --stat "--pretty=format:%nFrom %H Mon Sep 17 00:00:00 2001%nFrom: %an <%ae>%nDate: %ad%nSubject: %s%n%b%n" $change -- $srcdir >> $localDiff
+ echo "-- " >> $localDiff
+ echo "1.2.3" >> $localDiff
+ echo >> $localDiff
+ done
+ if [ -s $localDiff ]; then
+ echo "Saved locally applied patches to $localDiff"
+ else
+ localDiff=""
+ fi
+else
+ mkdir -p $srcdir
+fi
+
+git read-tree --prefix=$srcdir $rev
+git checkout $srcdir
+
+cat >commitlog.txt <<EOT
+Updated V8 from $repository to $rev
+EOT
+
+echo "Changes:"
+echo
+git --no-pager diff --name-status --cached $srcdir
+
+echo
+echo "Wrote commitlog.txt. Use with"
+echo
+echo " git commit -e -F commitlog.txt"
+echo
+echo "to commit your changes"
+
+if [ -n "$localDiff" ]; then
+ echo
+ echo "The Qt specific modifications to V8 are now stored as a git patch in $localDiff"
+ echo "You may want to appy them with"
+ echo
+ echo " git am -3 $localDiff"
+ echo
+fi