# You should have received a copy of the GNU Affero General Public License
# along with Busy. If not, see <http://www.gnu.org/licenses/>.
-url="$(echo "$_GET[\"i\"]" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;p}')"
+url="$(echo "$_GET[\"i\"]" |sed -rn '1{s:\t: :g;s:\r::g;s:\\:\\\\:g;s:/+:/:g;p}')"
rev="$(echo "$_GET[\"r\"]" |sed -rn '1{/^[0-9]+$/p}')"
baseuri=$(sed -rn 's:^svnRepo=(.*)$:\1:p' project.meta)
[ -z "$rev" ] && rev="$lastrev"
svn_path(){
- tmp="$url"
- until [ -z "$tmp" -o "$tmp" = '//' -o "$tmp" = './' ]; do
- echo "<a href='?p=Subversion&i=$tmp&r=$rev'>/$(basename "$tmp")</a> "
- tmp="$(dirname "$tmp")/"
+ tmp="${url%/*}"
+ until [ "$tmp" = "${tmp#/}" ]; do
+ echo "<a href='?p=Subversion&i=$tmp/&r=$rev'>${tmp##*/}/</a> "
+ tmp="${tmp%/*}"
done \
| tac
+ echo "${url##*/}"
}
svn_revisions(){
}
svn_showurl(){
- if (egrep -q '^(.*/|)$' <<<"$url"); then
+ if [ -z "$url" -o "${url%/}" != "$url" ]; then
# we are showing a directory
svn propget svn:externals -r "$rev" "${baseuri}/${url}" \
| sed -rn "s;^([^ ]+) (.+)$;<span class='extern'>\2/</span> [external include from <a href='\1'>\1</a>]<br>;p"
svn ls -r "$rev" "${baseuri}/${url}" \
- | sed -r "s:^.*$:<a href='?p=Subversion\&i=$url/&\&r=$rev'>&</a><br>:g"
+ | sed -r "s:^.*$:<a href='?p=Subversion\&i=$url&\&r=$rev'>&</a><br>:g"
else
# we are showing a file
- echo -E "$url" |egrep -vq '\.' && \
+ if [ "$url" = "${url#*.}" ] && \
lang=txt \
- || lang=$(
- source-highlight --lang-list \
- | grep -o "^${url##*.} " || echo sh
- )
+ || lang="$(source-highlight --lang-list |grep -o "^${url##*.} ")"
+ lang="${lang:-sh}"
lang="${lang% }"
svn cat -r "$rev" "${baseuri}/${url}" \
| source-highlight -s "$lang"