svn2web

svn2web is a subversion hook script that uploads the committed files to a server by the ftp or sftp protocol. With this script it’s very easy to keep your local development branch of your web project synchronized with your server as long as you don’t make server-side changes.

Be aware that you complete the PATH variable as the script isn’t executed in an interactive shell. This means no .bashrc or .profile are read. So you have to set PATH by yourself. You also have to pay attention to the order of the binary locations. I had some trouble with the Leopard1 svn installation and the macports installation. The former was an older version which couldn’t work with repository created by the latter.

If you get one of these error messages

svnlook expected fs format '2'; found format '4'

or

Invalid change kind in rev file

take a look at the PATH before you start debugging svn2web ;-)

For those who want to set ftp/sftp options you can do this by setting the svn property svn2web-options. Unfortunately this is nowhere documented so if it’s not working properly you should contact the dev team or fix it by yourself. Don’t forget to spread the bugfix with the world.

  1. The cat I got from the Apple zoo
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

source url not under source root

I’ve tried to mirror a svn repository and svk (yes svk and not svn!) told me that the source url is not under source root whatever this means.

An escaped space character caused svk fail the check:

if substr( $source_path, 0, length( $source_root ), '') ne $source_root;

in line 162 in SVNRa.pm.

I fixed this problem while adding a line which replaces %20 by a space character because an URL with the file protocol must not be escaped. These resources are accessed directly from the disk and not from a webserver.

$source_path =~ s/ /%20/g if $source_path =~ m,^file://,;

# XXX: this shouldn't happen. kill this substr
die "source url not under source root"
if substr( $source_path, 0, length( $source_root ), '') ne $source_root;
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Let SVN accept revision propchanges

The following message appears if you try to modify properties (e.g. the log message) while the propchanges hook is not enabled.

Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook

This hook is nothing else than an executable script located in repos/hooks/ that exits with 0 or 1 if defined conditions are not fulfilled. You can remove the file suffix tmpl from pre-revprop-change.tmpl1 if the template already exists or you create it from the scratch.

For Unix systems the script looks like

#!/bin/sh
exit 0;

and for Windows it’s

@echo off
exit /B 0
  1. On Windows the suffix shouldn’t be removed but changed from tmpl to bat instead.
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

MKACTIVITY – Subversion error

MKACTIVITY prohibits my Mactivity on SVN. I got this error when I tried to commit my “collapsable blogroll” code:

svn: Übertragen fehlgeschlagen (Details folgen):
svn: MKACTIVITY von '/!svn/act/fd9073ea-f545-4631-9eec-86beecf71150': Autorisierung fehlgeschlagen (http://svn.wp-plugins.org)

I googled for it and it seems to be a mac specific problem. You have to delete ~/.subversion. Then you’re able to commit with

svn ci --username yourname --password yourpassword -m "Your message"
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Dead weblocs

For one of my projects I checked in my .webloc files into my subversion repository. It was a really bad idea. The web locations are stored in the resource fork which will be lost after check-in. No chance to recover them :(

If you wish to share your web shortcuts you should use .url files that are common in Windows. Safari is able to read them too. So there’s no obstacle anymore to share your web shortcuts.

The format of the content of such a file is very simple:
[InternetShortcut]
URL=http://www.example.com

You should add a closing line feed, otherwise some browsers open an empty tab.
I found a script written by Joachim Bondo that converts .webloc into .url files.

property devToolsPath : "/Developer/Tools/" -- path to free Apple Developer Tools

on open draggedFiles
  local theFile, weblocPath, urlPath, theURL, cmd
  repeat with theFile in draggedFiles
    if (theFile as string) ends with ".webloc" then
      -- get full paths
      set weblocPath to quoted form of POSIX path of theFile
      set urlPath to text 1 thru -9 of weblocPath & ".url'"
      -- 1) get URL from .webloc file
      set cmd to devToolsPath & "DeRez -e -only 'url ' " & weblocPath & ¬
        " | grep '/* .* */' | sed 's/^.*/* //;s/ */$//' | tr -d 'n'"
      set theURL to do shell script cmd
      if theURL begins with "http" then
        -- 2) write URL to file
        set cmd to "echo '[InternetShortcut]" & (ASCII character 10) & ¬
          "URL=" & theURL & "' > " & weblocPath
        do shell script cmd
        -- 3) rename file using MvMac now that we have Developer Tools anyway
        set cmd to devToolsPath & "MvMac " & weblocPath & " " & urlPath
        do shell script cmd
      end if
    end if
  end repeat
end open

If you just want to get the address from the .webloc file you can use the script from this site:

set the_file to choose file
try
    tell application "Finder"
        set the_location to location of file the_file
        display dialog the_location buttons {"OK"} default button 1
    end tell
end try
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare