From f4ce3e600c5f52b07bbf25304694149c262d023a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 5 Jan 2012 14:18:03 +0100 Subject: [PATCH] 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 --- README | 21 +++++++------ bin/update-v8.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 9 deletions(-) create mode 100755 bin/update-v8.sh diff --git a/README b/README index 2672f6d..3b66d25 100644 --- a/README +++ b/README @@ -5,16 +5,19 @@ affects V8 itself and not the build system around it. Updating v8: -1) Reset src/3rdparty/v8 to a V8 commit of your choice, for example: +Run - git fetch https://github.com/v8/v8.git refs/tags/3.7.2 - git rm --cached -r src/3rdparty/v8 - git read-tree --prefix=src/3rdparty/v8 FETCH_HEAD - git checkout src/3rdparty/v8 - git commit + ./bin/update-v8.sh [url] [refspec] -2) Cherry-pick our modifications from before: +to update src/3rdparty/v8 to a specific v8 version. The script will remove +all Qt specific modifications and save them in /tmp/v8_patch, where they +can be applied from using git am. - gitk src/3rdparty/v8 +For example: - and then cherry-pick the changes since the last v8 import. + ./bin/update-v8.sh https://github.com/v8/v8.git refs/tags/3.7.3 + git commit -e -F commitlog.txt + git am -3 /tmp/v8_patch + +In the likely case of conflicts, follow the git instructions about continuing +the patch application process after resolving the conflicts. 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 <