Extend the update-v8.sh script
authorPeter Varga <pvarga@inf.u-szeged.hu>
Thu, 23 Feb 2012 16:20:21 +0000 (17:20 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 23 Feb 2012 16:43:34 +0000 (17:43 +0100)
Add support for update V8 sources to a particular commit.

Change-Id: I2c81c4f79e9e1d980c6db2299dbca02b6a97f751
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
bin/update-v8.sh

index 12276a2..8e5570c 100755 (executable)
@@ -48,8 +48,12 @@ die() {
 if [ $# -eq 2 ]; then
     repository=$1
     tag=$2
+elif [ $# -eq 3 ]; then
+    repository=$1
+    tag=$2
+    rev=$3
 else
-    die "usage: $0 [url] [commit]"
+    die "usage: $0 [url] [commit] ([hash])"
 fi
 
 require_clean_work_tree() {
@@ -76,7 +80,9 @@ if [ $? != 0 ]; then
     die "git fetch failed"
 fi
 
-rev=`git rev-parse FETCH_HEAD`
+if [ -z $rev ]; then
+    rev=`git rev-parse FETCH_HEAD`
+fi
 
 srcdir=src/3rdparty/v8
 absSrcDir=$PWD/$srcdir
@@ -107,6 +113,9 @@ else
 fi
 
 git read-tree --prefix=$srcdir $rev
+if [ $? != 0 ]; then
+    die "Invalid hash!"
+fi
 git checkout $srcdir
 
 cat >commitlog.txt <<EOT