equal
deleted
inserted
replaced
|
1 #!/bin/sh |
|
2 |
|
3 #HW_HG= |
|
4 |
|
5 if [ -z "$1" ]; then |
|
6 echo 'You have to supply at least one hedgewars git revision as parameter!' >&2 |
|
7 exit |
|
8 fi |
|
9 |
|
10 if [ -z "$HW_HG" ]; then |
|
11 HW_HG="$PWD" |
|
12 fi |
|
13 |
|
14 if [ ! -d "$HW_HG/.hg" ]; then |
|
15 echo 'You have to set HW_HG (inside script or env) to a repo clone OR call this script from inside the repository!' >&2 |
|
16 exit |
|
17 fi |
|
18 |
|
19 while [ ! -z "$1" ]; do |
|
20 echo |
|
21 echo |
|
22 echo '---------------------------------------------------------------' |
|
23 echo "$1" |
|
24 echo '---------------------------------------------------------------' |
|
25 url="https://github.com/hedgewars/hw/commit/$1" |
|
26 echo "Checking $url ..." |
|
27 echo |
|
28 page=$(wget -q -O- "$url") |
|
29 author=$(echo "$page" | sed -rn 's/^.*"author-name">(<[^>]*>)*([^ <]*).*/\2/ p') |
|
30 if [ -z "$author" ]; then |
|
31 echo 'Couldn'\''t find author! Skipping '"$1"' ...' >&2 |
|
32 shift |
|
33 continue |
|
34 fi |
|
35 echo 'Found author: '"$author" |
|
36 date=$(echo "$page" | sed -rn 's/^.*<time datetime="([^T]+)T([^Z]+).*/\1 \2 +0000/ p') |
|
37 if [ -z "$date" ]; then |
|
38 echo 'Couldn'\''t find date! Skipping '"$1"' ...' >&2 |
|
39 shift |
|
40 continue |
|
41 fi |
|
42 echo 'Found date: '"$date" |
|
43 echo |
|
44 echo 'Checking mercurial log for matches ...' |
|
45 echo |
|
46 result=$(hg log -R "$HW_HG" -u "$author" -d "$date" -v -l1) |
|
47 if [ -z "$result" ]; then |
|
48 echo 'No match :(' |
|
49 shift |
|
50 continue |
|
51 fi |
|
52 rev=$(echo "$result" | sed 's/^.*://;q') |
|
53 echo 'Found match: r'"$rev" |
|
54 echo 'Link: https://code.google.com/p/hedgewars/source/detail?r='"$rev" |
|
55 echo |
|
56 echo "$result" |
|
57 # proceed to next parameter |
|
58 shift |
|
59 done |
|
60 |
|
61 echo |
|
62 |