]> git.plutz.net Git - busy/commitdiff
stubs for implementing GIT support (if only GIT would support that...)
authorpaul <paul@plutz.net>
Fri, 13 Apr 2012 08:16:47 +0000 (08:16 +0000)
committerpaul <paul@plutz.net>
Fri, 13 Apr 2012 08:16:47 +0000 (08:16 +0000)
svn path=/trunk/; revision=43

Admin.page
Git.page [new file with mode: 0755]
project.meta

index f7bacc2bb9b413810c972bee4d3abcb00c6166ec..8bc7e4f8f9fe0aa359c7ad74fae2ada071efb63b 100644 (file)
@@ -24,8 +24,8 @@ else
       <fieldset><legend>Code Browser</legend>
       <div class='key'><input type='radio' name='repoType' value='svn' $(grep -q repoType=svn $metafile && echo checked)>SVN Repository</div>
         <div class='value'><input type='text' name='svnRepo' value='$(sed -rn 's:^svnRepo=(.*)$:\1:p' "$metafile")'></div><br>
-      <div class='key'><input disabled type='radio' name='repoType' value='git' $(grep -q repoType=git $metafile && echo checked)>GIT Repository</div>
-        <div class='value'><input disabled type='text' name='gitRepo' value='$(sed -rn 's:^gitRepo=(.*)$:\1:p' "$metafile")'></div><br>
+      <div class='key'><input type='radio' name='repoType' value='git' $(grep -q repoType=git $metafile && echo checked)>GIT Repository</div>
+        <div class='value'><input type='text' name='gitRepo' value='$(sed -rn 's:^gitRepo=(.*)$:\1:p' "$metafile")'></div><br>
       </fieldset>
 
       <fieldset><legend>Donations</legend>
diff --git a/Git.page b/Git.page
new file mode 100755 (executable)
index 0000000..236f767
--- /dev/null
+++ b/Git.page
@@ -0,0 +1,48 @@
+#!/bin/zsh
+url="$(sed -rn 's:\+: :g;s:%:\\x:g;s:^(.*&)?i=([^&]+)(&.*)?$:\2:p' <<<"${QUERY_STRING}")"
+url="$(echo -e "${url}" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
+rev="$(sed -rn 's:\+: :g;s:%:\\x:g;s:^(.*&)?r=([0-9a-fA-F]+)(&.*)?$:\2:p' <<<"${QUERY_STRING}")"
+
+baseuri=$(sed -rn 's:^gitRepo=(.*)$:\1:p' project.meta)
+[ -z "$rev" ] && rev="HEAD"
+
+cat <<SVNEND
+  <div id="LEFT">
+    <h1>Path:</h1>
+    <a href='?p=Subversion&amp;i=/&amp;r=$rev'>[root]</a> 
+    $(tmp=$url
+    until [ -z "$tmp" -o "$tmp" = // ]; do
+      echo "<a href='?p=Git&amp;i=$tmp&amp;r=$rev'>/$(basename "$tmp")</a> "
+      tmp=$(dirname "$tmp")/
+    done |tac)
+    <hr><!----------------------------------------------->
+    <h1>Tags:</h1>
+    $(for i in {1.."$lastrev"}; do
+      echo "<a href='?p=Git&amp;i=$url&amp;r=$i'>$i</a>"
+    done)
+
+    <h1>Branches:</h1>
+    $(for i in {1.."$lastrev"}; do
+      echo "<a href='?p=Git&amp;i=$url&amp;r=$i'>$i</a>"
+    done)
+  </div>
+
+  <div id="RIGHT">
+    <h1>Changelog:</h1><hr>
+    $(svn log $(egrep -q '^(.*/|)$' <<<"$url" && echo '') "${baseuri}/${url}" |\
+      sed -rn '2,${s:^-+$:</div>:g;
+      s:^r([0-9]+) \| ([a-zA-Z0-9]+) \| ([0-9: -]+) .+$:<div class="changelog"><h2>Revision \1 by \2<br>at \3</h2>:g;p}')
+  </div>
+
+  <div id="MAIN">
+  <div class='wikitext'><h1>$(basename "$url"), Revision "$rev":</h1>
+  $(if (egrep -q '^(.*/|)$' <<<"$url"); then #are we showing a directory
+    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 #or are we showing a file
+    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"
+  fi)
+  </div></div>
+SVNEND
index b985f72f666d3a88b937e2901f2b41dd4805b79c..157ca58c4da8c100cbc77dcd64862293502efe12 100644 (file)
@@ -2,7 +2,7 @@ name=Busy
 slogan=Letting You do the Work.
 repoType=svn
 svnRepo=http://svn.plutz.net/busy
-gitRepo=
+gitRepo=http://d00m.org/~someone/git/qtc.git
 useFlattr=yes
 flattrThingURL=http://flattr.com/thing/599434/Busy-Software-Project-Management
 usePaypal=