Gentoo Archives: gentoo-dev

From: Aron Griffis <agriffis@g.o>
To: gentoo-dev@××××××××××××.org
Subject: Re: [gentoo-dev] Planet Gentoo released
Date: Sat, 12 Mar 2005 03:57:08
Message-Id: 20050312035613.GC20707@time.flatmonk.org
In Reply to: Re: [gentoo-dev] Planet Gentoo released by Mike Frysinger
1 Vapier wrote: [Fri Mar 11 2005, 03:38:35PM EST]
2 > or committing something to cvs and wishing there was a link you could pull up
3 > in viewcvs to give to users when closing bugs rather than waiting around for
4 > 30+ minutes for the changes to appear in viewcvs
5
6 $ vc keychain*
7 http://www.gentoo.org/cgi-bin/viewcvs.cgi/net-misc/keychain/keychain-2.5.1.ebuild?rev=1.3&content-type=text/vnd.viewcvs-markup
8 http://www.gentoo.org/cgi-bin/viewcvs.cgi/net-misc/keychain/keychain-2.5.1.ebuild?r1=1.2&r2=1.3
9 http://www.gentoo.org/cgi-bin/viewcvs.cgi/net-misc/keychain/keychain-2.5.3.1.ebuild?rev=1.1&content-type=text/vnd.viewcvs-markup
10
11 # vc: generate viewcvs urls from the current directory
12 vc() {
13 declare f rev cwd orevn
14 declare -a orev
15 [[ -n $* ]] || set -- *
16
17 cwd=${PWD#*/portage}
18 cwd=${cwd#*/gentoo-x86}
19 cwd=${cwd#/}
20
21 for f in "$@"; do
22 [[ -f "$f" ]] || continue
23 rev=$(egrep -m1 -o '\$(Header|Id):[^$]*\$' "$f")
24 [[ -n $rev ]] && rev=$(echo "$rev" | cut -d' ' -f3)
25 [[ -n $rev ]] || rev=$(cvs log "$f" 2>/dev/null | awk '/^head:/{print $2}')
26 [[ -n $rev ]] || continue # oh well
27
28 printf "%s/%s/%s?rev=%s&content-type=text/vnd.viewcvs-markup\n" \
29 "http://www.gentoo.org/cgi-bin/viewcvs.cgi" "$cwd" "$f" "$rev"
30
31 if [[ $rev != *.1 ]]; then
32 orev=( $(sed 's/\(.*\.\)\(.*\)/\1 \2/g' <<<"$rev") )
33 (( orev[1]-- ))
34 printf "%s/%s/%s?r1=%s&r2=%s\n" "http://www.gentoo.org/cgi-bin/viewcvs.cgi" \
35 "$cwd" "$f" "${orev[0]}${orev[1]}" "$rev"
36 fi
37 done
38 }
39
40 --
41 Aron Griffis
42 Gentoo Linux Developer