From: paul Date: Sun, 14 Jun 2015 22:39:19 +0000 (+0000) Subject: hint on svn externals in subversion browser X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=a0a502c443ab0a8933ed0da159dfd59af59ea65b;p=busy hint on svn externals in subversion browser svn path=/trunk/; revision=66 --- diff --git a/pages/Subversion.sh b/pages/Subversion.sh index fa86d8b..5692d56 100755 --- a/pages/Subversion.sh +++ b/pages/Subversion.sh @@ -24,6 +24,48 @@ baseuri=$(sed -rn 's:^svnRepo=(.*)$:\1:p' project.meta) lastrev=$(svn info "$baseuri" |sed -rn 's;^Revision: *([0-9]+);\1;p') [ -z "$rev" ] && rev="$lastrev" +svn_path(){ + tmp="$url" + until [ -z "$tmp" -o "$tmp" = '//' -o "$tmp" = './' ]; do + echo "/$(basename "$tmp") " + tmp="$(dirname "$tmp")/" + done \ + | tac +} + +svn_revisions(){ + for i in {1.."$lastrev"}; do + echo "$i" + done +} + +svn_changelog(){ + svn log "${baseuri}/${url}" \ + | sed -rn '2,${s:^-+$::g; + s:^r([0-9]+) \| ([a-zA-Z0-9]+) \| ([0-9: -]+) .+$:

Revision \1 by \2
at \3

:g;p}' +} + +svn_showurl(){ + if (egrep -q '^(.*/|)$' <<<"$url"); then + # we are showing a directory + svn propget svn:externals -r "$rev" "${baseuri}/${url}" \ + | sed -rn "s;^([^ ]+) (.+)$;\2/ [external include from \1]
;p" + + svn ls -r "$rev" "${baseuri}/${url}" \ + | sed -r "s:^.*$:&
:g" + else + # we are showing a file + echo -E "$url" |egrep -vq '\.' && \ + lang=txt \ + || lang=$( + source-highlight --lang-list \ + | grep -o "^${url##*.} " || echo sh + ) + svn cat -r "$rev" "${baseuri}/${url}" \ + | source-highlight -s "$lang" + fi +} + case "$1" in title) echo "Code" diff --git a/templates/Subversion.page b/templates/Subversion.page index 72f8189..73cb146 100755 --- a/templates/Subversion.page +++ b/templates/Subversion.page @@ -4,34 +4,19 @@ cat <

Path:

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

Revisions:

- $(for i in {1.."$lastrev"}; do - echo "$i" - done) + $(svn_revisions)
:g; - s:^r([0-9]+) \| ([a-zA-Z0-9]+) \| ([0-9: -]+) .+$:

Revision \1 by \2
at \3

:g;p}') + $(svn_changelog)
-
-

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

- $(if (egrep -q '^(.*/|)$' <<<"$url"); then #are we showing a directory - svn ls -r "$rev" "${baseuri}/${url}" |sed -r "s:^.*$:&
:g" - echo '
' - 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) +
+

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

+ $(svn_showurl)
SVNEND