| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
die() { |
| 4 |
echo $* |
| 5 |
exit 1 |
| 6 |
} |
| 7 |
|
| 8 |
if [ $# -eq 2 ]; then |
| 9 |
repository=$1 |
| 10 |
tag=$2 |
| 11 |
else |
| 12 |
die "usage: $0 [path to local full webkit repository] [commit]" |
| 13 |
fi |
| 14 |
|
| 15 |
require_clean_work_tree() { |
| 16 |
# test if working tree is dirty |
| 17 |
git rev-parse --verify HEAD > /dev/null && |
| 18 |
git update-index --refresh && |
| 19 |
git diff-files --quiet && |
| 20 |
git diff-index --cached --quiet HEAD || |
| 21 |
die "Working tree is dirty" |
| 22 |
} |
| 23 |
|
| 24 |
test -z "$(git rev-parse --show-cdup)" || { |
| 25 |
exit=$? |
| 26 |
echo >&2 "You need to run this command from the toplevel of the working tree." |
| 27 |
exit $exit |
| 28 |
} |
| 29 |
|
| 30 |
echo "checking working tree" |
| 31 |
#require_clean_work_tree |
| 32 |
|
| 33 |
echo "replacing $srcdir" |
| 34 |
git read-tree --empty |
| 35 |
git clean -fdx |
| 36 |
|
| 37 |
repogit="git --git-dir=$repository/.git" |
| 38 |
|
| 39 |
subdirs=`$repogit ls-tree --name-only $tag | grep -v LayoutTests | grep -v Websites | grep -v PerformanceTests | grep -v ManualTests` |
| 40 |
|
| 41 |
$repogit archive --format=tar $tag $subdirs | tar xf - |
| 42 |
if [ $? != 0 ]; then |
| 43 |
die "archiving failed" |
| 44 |
fi |
| 45 |
|
| 46 |
#tarball=`mktemp /tmp/webkit-snapshot.tar.XXXXXX` || exit 1 |
| 47 |
#$repogit archive --format=tar $tag LayoutTests > $tarball |
| 48 |
#testResultsToExclude=`$repogit ls-tree --name-only $tag LayoutTests/platform | grep -v qt` |
| 49 |
#for dir in $testResultsToExclude; do |
| 50 |
# tar --delete --file=$tarball $dir |
| 51 |
#done |
| 52 |
#tar xf $tarball |
| 53 |
#rm -f $tarball |
| 54 |
|
| 55 |
git add . |
| 56 |
git diff-files --name-only -z | git update-index --remove -z --stdin |
| 57 |
|
| 58 |
rev=`$repogit rev-parse $tag` |
| 59 |
svnrev=`$repogit cat-file commit $tag |grep git-svn-id:` |
| 60 |
if [ -n "$svnrev" ]; then |
| 61 |
svnrev=`echo $svnrev | cut -d ' ' -f 2` |
| 62 |
fi |
| 63 |
|
| 64 |
if [ -n "$svnrev" ]; then |
| 65 |
svnrev=" ($svnrev)" |
| 66 |
fi |
| 67 |
|
| 68 |
cat >commitlog.txt <<EOT |
| 69 |
Imported WebKit commit $rev$svnrev |
| 70 |
EOT |
| 71 |
|
| 72 |
echo "Changes:" |
| 73 |
echo |
| 74 |
git --no-pager diff --name-status --cached $srcdir |
| 75 |
|
| 76 |
echo |
| 77 |
echo "Wrote commitlog.txt. Use with" |
| 78 |
echo |
| 79 |
echo " git commit -e -F commitlog.txt" |
| 80 |
echo |
| 81 |
echo "to commit your changes" |