aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:52:45 +0000
committerfuzzyray <fuzzyray@gentoo.org>2009-04-30 21:52:45 +0000
commit86eaf5e03289e45a95514b4f6011157972016e9d (patch)
treec16903693f2030c7b01b346b29b265dc1a473888 /src/eviewcvs
parentFix has_key() deprecation message. (Bug #232797) (diff)
downloadgentoolkit-0.2.4.tar.gz
gentoolkit-0.2.4.tar.bz2
gentoolkit-0.2.4.zip
Tagging the gentoolkit-0.2.4 releasegentoolkit-0.2.4
svn path=/tags/gentoolkit-0.2.4/; revision=564
Diffstat (limited to 'src/eviewcvs')
-rw-r--r--src/eviewcvs/AUTHORS1
-rw-r--r--src/eviewcvs/Makefile22
-rw-r--r--src/eviewcvs/README11
-rwxr-xr-xsrc/eviewcvs/eviewcvs95
-rw-r--r--src/eviewcvs/eviewcvs.pod48
5 files changed, 177 insertions, 0 deletions
diff --git a/src/eviewcvs/AUTHORS b/src/eviewcvs/AUTHORS
new file mode 100644
index 0000000..36d5bfd
--- /dev/null
+++ b/src/eviewcvs/AUTHORS
@@ -0,0 +1 @@
+Aron Griffis <agriffis@gentoo.org>
diff --git a/src/eviewcvs/Makefile b/src/eviewcvs/Makefile
new file mode 100644
index 0000000..ee4208f
--- /dev/null
+++ b/src/eviewcvs/Makefile
@@ -0,0 +1,22 @@
+# Copyright 2005 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+%.1 : %.pod
+ pod2man $< > $@
+
+.PHONY: all
+all: eviewcvs.1
+
+dist: eviewcvs.1
+ mkdir -p ../../$(distdir)/src/eviewcvs/
+ cp Makefile AUTHORS README eviewcvs eviewcvs.pod eviewcvs.1 ../../$(distdir)/src/eviewcvs/
+
+install: all
+ install -m 0755 eviewcvs $(bindir)/
+ install -d $(docdir)/eviewcvs
+ install -m 0644 AUTHORS README $(docdir)/eviewcvs/
+ install -m 0644 eviewcvs.1 $(mandir)/
diff --git a/src/eviewcvs/README b/src/eviewcvs/README
new file mode 100644
index 0000000..c7258d7
--- /dev/null
+++ b/src/eviewcvs/README
@@ -0,0 +1,11 @@
+Most of the documentation is contained in the man-page, which you can
+read directly (using GNU man) by doing
+
+ man ./eviewcvs.1
+
+To rebuild the man-page from pod source, do
+
+ pod2man --name=eviewcvs --center='Gentoolkit' \
+ eviewcvs.pod eviewcvs.1
+
+03 Nov 2004 agriffis
diff --git a/src/eviewcvs/eviewcvs b/src/eviewcvs/eviewcvs
new file mode 100755
index 0000000..280ec0b
--- /dev/null
+++ b/src/eviewcvs/eviewcvs
@@ -0,0 +1,95 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 2005, Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Written by Aron Griffis <agriffis@gentoo.org>
+#
+# eviewcvs - generate viewcvs urls for some files
+#
+
+if [[ -t 1 ]]; then
+ blue=""
+ cyan=""
+ green=""
+ red=""
+ off=""
+else
+ unset blue cyan green red off
+fi
+
+startdir="$PWD"
+url="http://sources.gentoo.org/viewcvs.py"
+unset diffs
+declare -a hdr orev
+
+chdir() {
+ cd "$1" || return
+
+ # Figure out where we are, hopefully
+ unset cwd root
+ if [[ -f CVS/Repository ]]; then
+ cwd=$(<CVS/Repository)
+ elif [[ -f .svn/entries ]]; then
+ cwd=$(grep -om1 'url=.*' .svn/entries)
+ cwd=${cwd#*/var/svnroot/}
+ cwd=${cwd%\"*}
+ fi
+}
+
+# Default to all files in directory
+[[ -n $* ]] || set -- *
+
+for f in "$@"; do
+ [[ -f $f ]] || continue
+
+ # Determine the directory settings
+ if [[ $f == */* ]]; then
+ chdir ${f%/*}
+ f=${f##*/}
+ else
+ chdir ${startdir}
+ fi
+
+ # Default to the directory settings
+ fwd=$cwd
+
+ # Get the header for this file, from which we can extract the root,
+ # directory and revision
+ 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
+ ;;
+ '')
+ 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
+
+ # Here is the simple URL to view it
+ echo "${url}/${fwd:+$fwd/}${green}${f}${off}?rev=${frev}&view=markup"
+
+ # Also supply a diff URL if possible
+ if [[ ${frev##*.} -gt 1 ]]; then
+ 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}&r2=${frev}"
+ fi
+done
+
+if [[ -n ${diffs} ]]; then
+ echo "${diffs}"
+fi
+
+# vim:set expandtab sw=4 smarttab:
diff --git a/src/eviewcvs/eviewcvs.pod b/src/eviewcvs/eviewcvs.pod
new file mode 100644
index 0000000..b4403c8
--- /dev/null
+++ b/src/eviewcvs/eviewcvs.pod
@@ -0,0 +1,48 @@
+=head1 NAME
+
+eviewcvs - Gentoo: generate viewcvs URLs
+
+=head1 SYNOPSIS
+
+eviewcvs [ I<files...> ]
+
+=head1 DESCRIPTION
+
+This tool generates a list of viewcvs URLs based on the files listed, or all the
+files in the current directory if the file list is omitted. The first part of
+the output, hilighted in green, is the simple URLs to view the files. The
+second part of the output, hilighted in blue, is the URLs to view the diffs
+against the previous revision.
+
+=head1 OPTIONS
+
+Presently eviewcvs is simple enough that it supplies no options.
+Probably I'll add B<--help> and B<--version> in the future, but for
+now it's enough to track the gentoolkit version.
+
+=head1 EXAMPLES
+
+To generate viewcvs URLs for a given file:
+
+ $ eviewcvs package.mask
+ http://www.gentoo.org/cgi-bin/viewcvs.cgi/profiles/package.mask?rev=1.3716&content-type=text/vnd.viewcvs-markup
+ http://www.gentoo.org/cgi-bin/viewcvs.cgi/profiles/package.mask?r1=1.3715&r2=1.3716
+
+To generate viewcvs URLs for all files in a directory:
+
+ $ cd portage/net-misc/keychain
+ $ eviewcvs
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/ChangeLog?rev=1.54&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/Manifest?rev=1.86&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.1.ebuild?rev=1.3&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.2.ebuild?rev=1.1&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/metadata.xml?rev=1.3&view=markup
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/ChangeLog?r1=1.53&r2=1.54
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/Manifest?r1=1.85&r2=1.86
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/keychain-2.6.1.ebuild?r1=1.2&r2=1.3
+ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/keychain/metadata.xml?r1=1.2&r2=1.3
+
+=head1 AUTHOR
+
+This tool was written by Aron Griffis <agriffis@gentoo.org>. Bugs
+found should be filed against me at http://bugs.gentoo.org/