tags:

views:

383

answers:

4

When you publish a Subversion repository trough Apache Httpd you got an bonus feature: you can browse the HEAD revision of you sources with any HTTP client.

For example, we have this repository:

http://trash-cli.googlecode.com/svn/trunk/

With any HTTP client (e.g. Firefox) you can browse the files at the HEAD revision. The svnbook explain very well how do that.

But Google Code Hosting offer an extra feature: you can browse also the past revisions. For example you can browse the r10 revision:

http://trash-cli.googlecode.com/svn-history/r10/trunk/

Do you know how Google do that? I want this feature in my company repository too! :)

Thanks

Update 1

The following behavior may help us to solve the problem. If I visit a path that doesn't exist in repository, for example

http://trash-cli.googlecode.com/svn-history/r10/non-existent

I got the following 404 error:

Not Found

The requested URL /svn/!svn/bc/10/non-existent was not found on this server.

I suspect that there is a URL rewrite rule under the scene.

Update 2

Please note that this is not the same of this question. I want to expose the this service on my company repository in a way that is comfortable to the user in a way that Google Code do, I'm not interested how to get old revision in a external repository that doesn't has this feature. I'm using the perspective of the service provider, not the perspective of the user. I want make life easier to my colleagues.

A: 

I believe the basic install (from the SubVersion team) doesn't come with this feature out of the box. I believe people have built extensions or programs on top of or in conjunction with a Subversion client to get that feature.

If you run the repository, you can probably install WebSVN (http://websvn.tigris.org/) to get what you need. There are other options, I'm sure.

Frank V
A: 

Append something like this to your repository URL:

!svn/bc/<revision_number>/

E.g.

http://www.example.com/svnrepository/!svn/bc/3/

Duplicate: http://stackoverflow.com/questions/651305/how-do-i-browse-an-old-revision-of-a-subversion-repository-through-the-web-view/651322

Seb
You are right, but it's not my problem. I should be more clear in what I'm asking. I updated the question title and description to make clearer my problem.
Andrea Francia
In any case: thanks!
Andrea Francia
A: 

I studied the Apache docs and I think it could be solved using this rule in httpd.conf.

RewriteRule ^/svn-history/r([0-9]+)/(.*) /svn/!svn/bc/$1/$2

I didn't yet test it. I'll test it later.

Andrea Francia
Look at my answer... I answered this in a previous question as well. You don't need any rewrite at all.
Seb
Yes, I see your point but read the Update 2 in the question.
Andrea Francia
+2  A: 

From the subversion 1.6 release notes:

New public 'historical' HTTP URI syntax for mod_dav_svn (server)

mod_dav_svn now supports a new public URI syntax for examining older versions of files or directories. The intent here is to allow users to examine history without the use of an svn client, and to make it easier for 3rd-party tools (e.g. code-review services) to work directly against repositories without using svn libraries.

http://host/repos/path?[p=PEG][&amp;r=REV]

Wim Coenen
Wow! This seems the cleanest solutions that I can find! The only problem is that at the moment I don't have subversion 1.6 on my Fedora and I don't know if there is an prebuilt RPM for that. Thanks anyway. +1
Andrea Francia
CollabNet provides svn rpm's (http://www.collab.net/downloads/subversion/redhat.html) but they have not yet packaged subversion 1.6.
Wim Coenen
Update: looks like they have packaged it now.
Wim Coenen