Getting specific revision via http with VisualSVN Server
Asked Answered
B

5

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.

Bedaub answered 1/10, 2008 at 13:29 Comment(0)
I
87

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

?p=Rev specifies the revision

Insinuate answered 21/6, 2010 at 12:59 Comment(1)
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...Cosetta
B
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.

Brandebrandea answered 22/2, 2009 at 11:24 Comment(3)
Interesting; I'll take a lookBedaub
VisualSVN doesn't use that format. See @chhenni's answer above.Norrie
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.mdtextPassport
W
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.]

Whoopee answered 1/10, 2008 at 13:59 Comment(2)
Interesting - very, very interesting. I'll give that a whirl.Bedaub
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)Whoopee
G
2

This:

Use of WebDAV in Subversion

should help.

Guillema answered 22/2, 2009 at 12:24 Comment(0)
B
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.

Barbuto answered 22/2, 2019 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.