From 3a44d73fa1e0b84c0cf111f50059afd089843cbb Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 22 Aug 2011 15:45:56 +0000 Subject: [PATCH] introduced svn repo browser svn path=/trunk/; revision=9 --- Subversion.page | 43 +++++++++++++++++++++++++++++++++++++++++++ index.cgi | 2 +- project.meta | 1 + wikitext.css | 1 + 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 Subversion.page diff --git a/Subversion.page b/Subversion.page new file mode 100755 index 0000000..e08c9aa --- /dev/null +++ b/Subversion.page @@ -0,0 +1,43 @@ +#!/bin/zsh +url="$(egrep -o '(^|&)(i=).+(&|$)' <<<"${QUERY_STRING}" |sed -r 's:^&?i=::;s:&.*::;s:\+: :g;s:%:\\x:g')" +url="$(echo -e "${url}" |sed 's:\t: :g;s:\r::g;s:\\:\\\\:g' |head -n1)" +rev="$(egrep -o '(^|&)(r=)[0-9]+(&|$)' <<<"${QUERY_STRING}" |tr -d 'r=&')" + +baseuri=$(egrep '^repo=.*$' project.meta |cut -d= -f2-) +lastrev=$(svn info "$baseuri" |egrep '^Revision:' |cut -d\ -f2) +[ -z "$rev" ] && rev="$lastrev" + +cat < +

Path:

+ [root] +SVNEND +tmp=$url +until [ -z "$tmp" -o "$tmp" = // ]; do + echo "/$(basename "$tmp") " + tmp=$(dirname "$tmp")/ +done |tac +echo '

Revisions:

' +for i in {1.."$lastrev"}; do + echo "$i" +done + +cat < + + + +
+

$(basename "$url"), Revision "$rev":

+SVNEND +if (egrep -q '^(.*/|)$' <<<"$url"); then + svn ls -r "$rev" "${baseuri}/${url}" |sed -r "s:^.*$:&
:g" + echo '
' +else + lang=$(source-highlight --lang-list |cut -d\ -f1 |grep -x "$(sed 's:.*\.::g' <<<"$url")" || echo sh) + grep -q '\.' <<<"$url" || lang=txt + svn cat -r "$rev" "${baseuri}/${url}" |source-highlight -s "$lang" #|sed 's:<:\<:g;s:>:\>:g;' +fi +cat <
+SVNEND diff --git a/index.cgi b/index.cgi index 6710ea3..dc04c73 100755 --- a/index.cgi +++ b/index.cgi @@ -74,7 +74,7 @@ $( $LOGIN || echo '