33

I'm using VisualSVN Server to host an SVN repo, and for some automation work, I'd like to be able to get specific versions via the http[s] layer.

I can get the HEAD version simply via an http[s] request to the server (httpd?) - but is there any ability to specify the revision, perhaps as a query-string? I can't seem to find it...

I don't want to do a checkout unless I can help it, as there are a lot of files in the specific folder, and I don't want them all - just one or two.

bahrep
  • 26,679
  • 12
  • 95
  • 136
Marc Gravell
  • 927,783
  • 236
  • 2,422
  • 2,784

5 Answers5

87

Better late than never; https://entire/Path/To/Folder/file/?p=REV

?p=Rev specifies the revision

chhenni
  • 1,127
  • 9
  • 13
  • no acceptance since poster already went with the 'I don't know' answer. I always wondered how people make past 10k rep - now I know... –  Apr 16 '13 at 13:45
7

Dunno if you've already found the answer to this question but in regular svn server on apache you can get to a particular revision with:

http://host/svn-name/!svn/bc/REVISION_NUMBER/path/to/file.ext
  • host & REVISION_NUMBER are obvious
  • /path/to/file.ext is relative to repo root

I've never used visualsvn so your mileage may vary.

rundekugel
  • 679
  • 5
  • 17
grenade
  • 28,964
  • 22
  • 90
  • 125
  • Interesting; I'll take a look – Marc Gravell Feb 22 '09 at 19:42
  • 1
    VisualSVN doesn't use that format. See @chhenni's answer above. – Jon Adams Jun 21 '11 at 17:09
  • This seems like what I was after -- how to do it without something like visualsvn. I'm not sure I follow `!svn/bc/` part. How would you grab a specific revision from a path like this `http://svn.apache.org/repos/asf/httpd/site/trunk/content/index.mdtext` – David Blevins Jan 18 '13 at 03:38
4

Subversion does not publicly document the Uris it uses internally to access that information. (And where it is documented, it is explicitly stated that this can change in future versions)

To access this information on the web you could use a web viewer (E.g. websvn, viewvc).

If you want to access it from your own program you could also use a client binding like SharpSvn.

using (SvnClient client = new SvnClient())
using (FileStream fs = File.Create("c:\\temp\\file.txt"))
{
    // Perform svn cat http://svn.collab.net/svn/repos/trunk/COMMITTERS -r 23456 
    //                    > file.txt

    SvnCatArgs a = new SvnCatArgs();
    a.Revision = 23456;
    client.Cat(new Uri("http://svn.collab.net/svn/repos/trunk/COMMITTERS"), a, fs);
}

[Update 2008-12-31: One of the next few versions of Subversion will start documenting public urls you can use for retrieving old versions.]

Bert Huijben
  • 19,125
  • 4
  • 54
  • 71
  • Interesting - very, very interesting. I'll give that a whirl. – Marc Gravell Oct 03 '08 at 06:49
  • Note that more recent Subversion versions now have a public url syntax to retrieve old revisions. The @revision can be specified with ?p=revision and an -r rev using ?r=rev. (And these values can of course be combined) – Bert Huijben Sep 07 '12 at 17:29
2

The help page for the VisualSVN Web Interface suggests using an address formatted like one of these:

link to r1484 commit in the serf's project repository:
https://demo-server.visualsvn.com/!/#serf/commit/r1484/

link to the current content of the trunk/context.c file in the serf's project repository:
https://demo-server.visualsvn.com/!/#serf/view/head/trunk/context.c

link to the content of trunk/context.c file at revision r2222 in the serf's project repository:
https://demo-server.visualsvn.com/!/#serf/view/r2222/trunk/context.c

The crucial thing seems to be the repo revision number prefixed by 'r'. None of the other answers here mention that, and using addresses formatted like this I was able to view a specific revision of a source file from our VisualSVN server.

Brian THOMAS
  • 398
  • 3
  • 15
2

This:

Use of WebDAV in Subversion

should help.

martin clayton
  • 72,583
  • 29
  • 209
  • 194
Julian Reschke
  • 35,455
  • 7
  • 78
  • 83