Skip to content

Commit 1d4053e

Browse files
Adding useful scripts to parse revision info.
[email protected] Review URL: https://chromiumcodereview.appspot.com/16812003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@15078 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent 2c41661 commit 1d4053e

File tree

2 files changed

+255
-0
lines changed

2 files changed

+255
-0
lines changed

tools/v8-info.sh

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#!/bin/bash
2+
# Copyright 2013 the V8 project authors. All rights reserved.
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions are
5+
# met:
6+
#
7+
# * Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# * Redistributions in binary form must reproduce the above
10+
# copyright notice, this list of conditions and the following
11+
# disclaimer in the documentation and/or other materials provided
12+
# with the distribution.
13+
# * Neither the name of Google Inc. nor the names of its
14+
# contributors may be used to endorse or promote products derived
15+
# from this software without specific prior written permission.
16+
#
17+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
29+
30+
########## Global variable definitions
31+
32+
VERSION="src/version.cc"
33+
MAJOR="MAJOR_VERSION"
34+
MINOR="MINOR_VERSION"
35+
BUILD="BUILD_NUMBER"
36+
PATCH="PATCH_LEVEL"
37+
38+
V8="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
39+
40+
########## Function definitions
41+
42+
cd $V8
43+
44+
usage() {
45+
cat << EOF
46+
usage: $0 OPTIONS
47+
48+
Fetches V8 revision information from a git-svn checkout.
49+
50+
OPTIONS:
51+
-h Show this message.
52+
-i Print revision info for all branches matching the V8 version.
53+
-v Print the V8 version tag for a trunk SVN revision.
54+
-m Print all patches that were merged to the specified V8 branch.
55+
-p Print all patches merged to a specific V8 point-release.
56+
EOF
57+
}
58+
59+
tags() {
60+
git for-each-ref --format="%(objectname) %(refname:short)" refs/remotes/svn
61+
}
62+
63+
tag_revision() {
64+
cut -d" " -f1
65+
}
66+
67+
tag_log() {
68+
git log --format="%h %ci %ce %s" -1 $1
69+
}
70+
71+
v8_hash() {
72+
tags | grep "svn/tags/$1$" | tag_revision
73+
}
74+
75+
point_merges() {
76+
echo $1 | grep -o "r[0-9]\+"
77+
}
78+
79+
hash_to_svn() {
80+
git svn log -1 --oneline $1 | cut -d" " -f1
81+
}
82+
83+
tag_version() {
84+
tags | grep svn/tags/$1 | while read tag; do
85+
id=$(echo $tag | grep -o "[^/]*$")
86+
rev=$(echo $tag | tag_revision)
87+
svn=$(hash_to_svn $rev)
88+
echo $rev $svn $id
89+
done
90+
}
91+
92+
svn_rev() {
93+
git svn find-rev $2 svn/$1
94+
}
95+
96+
v8_rev() {
97+
cd $(git rev-parse --show-toplevel)
98+
rev=$(git show $1:$VERSION \
99+
| grep "#define" \
100+
| grep "$MAJOR\|$MINOR\|$BUILD\|$PATCH" \
101+
| grep -o "[0-9]\+$" \
102+
| tr "\\n" ".")
103+
echo ${rev%?}
104+
}
105+
106+
merges_to_branch() {
107+
git cherry -v svn/trunk svn/$1 | while read merge; do
108+
h=$(echo $merge | cut -d" " -f2)
109+
svn=$(svn_rev $1 $h)
110+
merges=$(echo $merge | grep -o "r[0-9]\+")
111+
echo branches/$1 r$svn $merges
112+
done
113+
}
114+
115+
########## Option parsing
116+
117+
while getopts ":hi:v:m:p:" OPTION ; do
118+
case $OPTION in
119+
h) usage
120+
exit 0
121+
;;
122+
i) tag_version $OPTARG
123+
;;
124+
v) v8_rev $(svn_rev trunk r$OPTARG)
125+
;;
126+
m) merges_to_branch $OPTARG
127+
;;
128+
p) point_merges "$(tag_log $(v8_hash $OPTARG)^1)"
129+
;;
130+
?) echo "Illegal option: -$OPTARG"
131+
usage
132+
exit 1
133+
;;
134+
esac
135+
done

tools/v8-rolls.sh

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
# Copyright 2013 the V8 project authors. All rights reserved.
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions are
5+
# met:
6+
#
7+
# * Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# * Redistributions in binary form must reproduce the above
10+
# copyright notice, this list of conditions and the following
11+
# disclaimer in the documentation and/or other materials provided
12+
# with the distribution.
13+
# * Neither the name of Google Inc. nor the names of its
14+
# contributors may be used to endorse or promote products derived
15+
# from this software without specific prior written permission.
16+
#
17+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
29+
30+
########## Global variable definitions
31+
32+
DEPS_STRING='"v8_revision":'
33+
INFO=tools/v8-info.sh
34+
35+
V8="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
36+
37+
########## Function definitions
38+
39+
usage() {
40+
cat << EOF
41+
usage: $0 OPTIONS
42+
43+
Run in chromium/src to get information about V8 rolls.
44+
45+
OPTIONS:
46+
-h Show this message.
47+
-n Number of rolls to print information about.
48+
-s Chromium git hash to start printing V8 information about.
49+
EOF
50+
}
51+
52+
v8_line() {
53+
git show $1:DEPS | grep -n $DEPS_STRING | cut -d":" -f1
54+
}
55+
56+
v8_info() {
57+
git blame -L$(v8_line $1),+1 $1 DEPS | grep $DEPS_STRING
58+
}
59+
60+
v8_svn() {
61+
sed -e 's/^.*"\([0-9]\+\)",$/\1/'
62+
}
63+
64+
v8_roll() {
65+
cut -d" " -f1
66+
}
67+
68+
find_rev() {
69+
git svn find-rev $1
70+
}
71+
72+
msg() {
73+
msg=$(git log --format="%h %ci %ce" -1 $1)
74+
h=$(echo $msg | cut -d" " -f1)
75+
d=$(echo $msg | cut -d" " -f2)
76+
t=$(echo $msg | cut -d" " -f3)
77+
a=$(echo $msg | cut -d" " -f5)
78+
a1=$(echo $a | cut -d"@" -f1)
79+
a2=$(echo $a | cut -d"@" -f2)
80+
echo $h $d $t $a1@$a2
81+
}
82+
83+
v8_revision() {
84+
cd $V8
85+
$INFO -v $1
86+
}
87+
88+
rolls() {
89+
roll=$2
90+
for i in $(seq 1 $1); do
91+
info=$(v8_info $roll)
92+
roll=$(echo $info | v8_roll $roll)
93+
trunk=$(echo $info | v8_svn $roll)
94+
echo "$(v8_revision $trunk) $trunk $(find_rev $roll) $(msg $roll)"
95+
roll=$roll^1
96+
done
97+
}
98+
99+
########## Option parsing
100+
101+
REVISIONS=1
102+
START=HEAD
103+
104+
while getopts ":hn:s:" OPTION ; do
105+
case $OPTION in
106+
h) usage
107+
exit 0
108+
;;
109+
n) REVISIONS=$OPTARG
110+
;;
111+
s) START=$OPTARG
112+
;;
113+
?) echo "Illegal option: -$OPTARG"
114+
usage
115+
exit 1
116+
;;
117+
esac
118+
done
119+
120+
rolls $REVISIONS $START

0 commit comments

Comments
 (0)