-
Notifications
You must be signed in to change notification settings - Fork 1
/
ticket2allura.sh
executable file
·54 lines (42 loc) · 1.11 KB
/
ticket2allura.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Traslate ticket numbers for SourceForge's project fuse-emulator from the old
# bug tracking system (Trac) to Allura.
#
# Note that SourceForge redirection was still available in 2015. This might
# change in the future.
# svn log | grep -o -E "#[0-9][0-9][0-9][0-9]+" | sort | uniq | \
# xargs -I{} ticket2allura.sh {} >> tickets_map.txt
AID_BUG=596648
AID_PATCH=596650
AID_FEATURE=596651
GROUP_ID=91293
TICKET=
get_ticket() {
OLD_URL="https://sourceforge.net/tracker/?func=detail&atid="$1"&aid="${2//#/}"&group_id="$GROUP_ID
NEW_URL=`curl -ILs -w "%{url_effective}\n" "$OLD_URL" | tail -1`
case "$NEW_URL" in
*legacy*) ;;
*) TICKET=${NEW_URL##*s/}; TICKET=${TICKET%/} ;;
esac
}
if test -z "$1"; then
echo "usage: ticket2allura.sh <artifact number>"
exit 2
fi
get_ticket $AID_PATCH $1
if test -n "$TICKET"; then
echo $1$'\t'"#"$TICKET
exit 0
fi
get_ticket $AID_BUG $1
if test -n "$TICKET"; then
echo $1$'\t'"#"$TICKET
exit 0
fi
get_ticket $AID_FEATURE $1
if test -n "$TICKET"; then
echo $1$'\t'"#"$TICKET
exit 0
fi
echo "Warning: artifact $1 not found" 1>&2
exit 1