]> git.plutz.net Git - busy/commitdiff
introduced svn repo browser
authorpaul <paul@plutz.net>
Mon, 22 Aug 2011 15:45:56 +0000 (15:45 +0000)
committerpaul <paul@plutz.net>
Mon, 22 Aug 2011 15:45:56 +0000 (15:45 +0000)
svn path=/trunk/; revision=9

Subversion.page [new file with mode: 0755]
index.cgi
project.meta
wikitext.css

diff --git a/Subversion.page b/Subversion.page
new file mode 100755 (executable)
index 0000000..e08c9aa
--- /dev/null
@@ -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 <<SVNEND
+  <div id="LEFT">
+    <h1>Path:</h1>
+    <a href='?p=Subversion&amp;i=/&amp;r=$rev'>[root]</a> 
+SVNEND
+tmp=$url
+until [ -z "$tmp" -o "$tmp" = // ]; do
+  echo "<a href='?p=Subversion&amp;i=$tmp&amp;r=$rev'>/$(basename "$tmp")</a> "
+  tmp=$(dirname "$tmp")/
+done |tac
+echo '<hr><h1>Revisions:</h1>'
+for i in {1.."$lastrev"}; do
+  echo "<a href='?p=Subversion&amp;i=$url&amp;r=$i'>$i</a>"
+done
+
+cat <<SVNEND
+  </div>
+
+  <div id="RIGHT"></div>
+
+  <div id="MAIN">
+  <div class='wikitext'><h1>$(basename "$url"), Revision "$rev":</h1>
+SVNEND
+if (egrep -q '^(.*/|)$' <<<"$url"); then
+  svn ls -r "$rev" "${baseuri}/${url}" |sed -r "s:^.*$:<a href='?p=Subversion\&amp;i=$url/&\&amp;r=$rev'>&</a><br>:g"
+  echo '</div>'
+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:<:\&lt;:g;s:>:\&gt;:g;'
+fi
+cat <<SVNEND
+  </div></div>
+SVNEND
index 6710ea357e3041dc8e735d66a587dd2d7cfe0140..dc04c7360515c106864391cbb3de739758905fd4 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -74,7 +74,7 @@ $( $LOGIN || echo '<form action="/login.cgi?'${QUERY_STRING:gs/&/&amp;/}'" metho
     <div id="MENU">
       <a href='/?p=Home'>Home</a>
       <a href='/?p=Wiki'>Wiki</a>
-      <a href='/?p=Code'>Code</a>
+      <a href='/?p=Subversion'>Code</a>
       <a href='/?p=Tasks'>Tasks</a>
     </div>
       $(if [ -r "./${page}.page" ]; then
index 8a85a26f70fae68be001fa7da3247e0458ab648e..415c0ec2700dafed62562ac8db585f5872a9e374 100644 (file)
@@ -1,2 +1,3 @@
 name=Busy
 slogan=Letting You do the Work.
+repo=http://svn.plutz.net/busy
index d635d64bf1b75e009d47f5ab4371b304a7cd01ac..1f0c5ea66af94a06177de331bcbf2e5b4683b388 100644 (file)
@@ -67,4 +67,5 @@
   padding: .5em;
   border-style: solid; border-width: 1px;
   border-color: #AAF;
+  overflow: scroll;
 }