diff options
| author | agriffis <agriffis@gentoo.org> | 2006-03-25 05:15:01 +0000 |
|---|---|---|
| committer | agriffis <agriffis@gentoo.org> | 2006-03-25 05:15:01 +0000 |
| commit | 8dddf328885e9606cad4e5f16acb7fc5f072fb24 (patch) | |
| tree | 673d3fe0e89dbc3f0dd298e96c3c7654a413ed8d | |
| parent | 8c6b8e79ebd2f7b8db6abee6a5e699f272d4b15a (diff) | |
| download | gentoolkit-8dddf328885e9606cad4e5f16acb7fc5f072fb24.tar.gz | |
Update to work with sources.gentoo.org
svn path=/; revision=288
| -rwxr-xr-x | trunk/src/eviewcvs/eviewcvs | 60 |
1 files changed, 25 insertions, 35 deletions
diff --git a/trunk/src/eviewcvs/eviewcvs b/trunk/src/eviewcvs/eviewcvs index 2953779..280ec0b 100755 --- a/trunk/src/eviewcvs/eviewcvs +++ b/trunk/src/eviewcvs/eviewcvs @@ -1,5 +1,5 @@ #!/bin/bash -# $Header$ +# $Id$ # # Copyright 2005, Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -19,8 +19,9 @@ else fi startdir="$PWD" -url="http://www.gentoo.org/cgi-bin/viewcvs.cgi" +url="http://sources.gentoo.org/viewcvs.py" unset diffs +declare -a hdr orev chdir() { cd "$1" || return @@ -29,11 +30,10 @@ chdir() { unset cwd root if [[ -f CVS/Repository ]]; then cwd=$(<CVS/Repository) - root=${cwd%%/*} - cwd=${cwd#*/} - elif [[ $PWD == */portage/* || $PWD == */gentoo-x86/* ]]; then - cwd=${PWD#*/portage} - cwd=${PWD#*/gentoo-x86} + elif [[ -f .svn/entries ]]; then + cwd=$(grep -om1 'url=.*' .svn/entries) + cwd=${cwd#*/var/svnroot/} + cwd=${cwd%\"*} fi } @@ -52,49 +52,39 @@ for f in "$@"; do fi # Default to the directory settings - froot=$root fwd=$cwd # Get the header for this file, from which we can extract the root, # directory and revision - header=$(egrep -m1 -o '\$(Header|Id):[^$]*\$' "$f") - frev=$(cut -d' ' -f3 <<<"$header") - case ${header} in - ?Header:\ /var/cvsroot/*/*/*) - fwd=$(cut -d' ' -f2 <<<"$header") # /var/cvsroot/gentoo-src/keychain/keychain.sh,v - f=${fwd##*/} # keychain.sh,v - f=${f%,v} # keychain.sh - froot=${fwd#/var/cvsroot/} # gentoo-src/keychain/keychain.sh,v - froot=${froot%%/*} # gentoo-src - fwd=${fwd#/var/cvsroot/*/} # gentoo-src/keychain/keychain.sh,v - fwd=${fwd%/*} # keychain - ;; - ?Header:\ /var/cvsroot/*/*) - f=$(cut -d' ' -f2 <<<"$header") # /var/cvsroot/gentoo-x86/skel.ebuild,v - froot=${f%/*} # /var/cvsroot/gentoo-x86 - froot=${froot##*/} # gentoo-x86 - f=${f##*/} # skel.ebuild,v - f=${f%,v} # skel.ebuild + hdr=( $(egrep -m1 -o '\$(Header|Id):[^$]*\$' "$f") ) + frev=${hdr[2]} + case ${hdr[*]} in + \$Header:\ /var/cvsroot/*/*\ \$*) + fwd=${hdr[1]} # /var/cvsroot/gentoo-src/keychain/keychain.sh,v + fwd=${fwd#/var/cvsroot/} # gentoo-src/keychain/keychain.sh,v + fwd=${fwd%/*} # gentoo-src/keychain ;; '') - [[ -d CVS ]] && frev=$(cvs log "$f" 2>/dev/null | awk '/^head:/{print $2}') + if [[ -d CVS ]]; then + frev=$(cvs log "$f" 2>/dev/null | awk '/^head:/{print $2}') + elif [[ -d .svn ]]; then + frev=$(svn info "$f" 2>/dev/null | awk '/^Revision:/{print $2}') + fi ;; esac [[ -n ${frev} ]] || continue - # gentoo-x86 is the default root - [[ -n ${froot} ]] || continue - [[ ${froot} == gentoo-x86 ]] && unset froot - # Here is the simple URL to view it - echo "${url}/${fwd:+$fwd/}${green}${f}${off}?rev=${frev}${froot:+&root=$froot}&content-type=text/vnd.viewcvs-markup" + echo "${url}/${fwd:+$fwd/}${green}${f}${off}?rev=${frev}&view=markup" # Also supply a diff URL if possible if [[ ${frev##*.} -gt 1 ]]; then - orev=($(sed 's/\(.*\)\.\(.*\)/\1 \2/g' <<<"$frev")) - (( orev[1]-- )) + orev=( ${frev//./ } ) # convert to array + (( orev[${#orev[@]}-1]-- )) # decrement the last element + orev=${orev[*]} # convert to string + orev=${orev// /.} # revert spaces to dots diffs="${diffs:+$diffs -}${url}/${fwd:+$fwd/}${blue}${f}${off}?r1=${orev[0]}.${orev[1]}&r2=${frev}${froot:+&root=$froot}" +}${url}/${fwd:+$fwd/}${blue}${f}${off}?r1=${orev}&r2=${frev}" fi done |
