Martin Atkins (mart) wrote in lj_dev,
Martin Atkins
mart
lj_dev

WebSVN

For those not in the know, Danga (and thus LiveJournal) is currently in the midst of migrating from CVS to Subversion, an alternative revision control system. It's better in a lot of ways, and removes a lot of the pain that CVS causes. That's not what I'm writing about, though.

I assume that the cvsweb interface at cvs.livejournal.org and cvs.danga.com will be replaced with a WebSVN interface. WebSVN looks pretty nice apart from one minor detail: ugly URLs. While most people will label me an insane fanatic for complaining about lack of pretty URLs, in this particular case I do actually have a valid reason which I will reveal in a moment.

WebSVN by default causes URLs like /listing.php?rep=3&path=/trunk/&rev=0&sc=1, which are chock full of stuff I don't really care about and would rather just have the server use intelligent defaults in most cases. For file commit histories, though, the format is /log.php?rep=3&path=/trunk/README&rev=0&sc=1. Here, rep and path are the index of a configured repository and the path to the thing to be displayed, respectively. rev is the global repository revision number, but having it at zero seems to just mean “most recent” and the last parameter sc means “Show changed files”, which includes a list of the files modified in that particular commit.

Now, quite often I read a bug report on Zilla or I encounter a weird behavior in my own development and want to quickly look up recent changes to a file. With the current CVSWeb interface, I simply copy-paste the path to the file and stick it on the end of a base URL and get the revision history of that file. Under WebSVN's default setup, this is less easy since I have to remember two silly parameter names and a filename. This is nothing a little mod_rewrite magic can't fix, though:

RewriteEngine on
RewriteRule ^/browse/(.*)/$ /listing.php?rep=1&path=$1
RewriteRule ^/browse/(.*[^/])$ /log.php?rep=1&path=$1

That second rule is a bit clunky and could probably be made more intuitive/efficient with a RewriteCond, but that's the general idea. Now I can go to (hypothetically speaking) http://code.danga.com/browse/wcmtools/s2/trunk/S2.pm for the commit history of S2.pm, with links to get inter-version diffs, read the latest version and so forth. Much prettier. For the more unusual stuff, like viewing a specific non-current revision of the repository, the nasty wacky URLs can be used, but I'd like to have a simple and intuitive URL for the common case of getting a specific directory listing or the commit log of a file.

If you won't do it on the server then I'll make my filtering proxy do it for me, but then everyone else will suffer! :)

Tags: cvs, svn
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 10 comments