Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is anyone aware of a way to access all revisions of a subversion repository within a file system? I would really benefit from being able to reference a file locally as, for example, "/var/svn/repo/rev4235/project/trunk/file.c" or such like.

I can fairly straightforwardly write some scripts to manually stage different versions of files out of subversion in a manually created directory tree or something, but directly reaching into svn would be much more preferable.

[aside: I'm aware of svnfs but this only presents the current revision, and whilst I've been able to create the exact functionality I need on apache, I can't see any way to maybe mount that web server e.g. httpfs (needs file range access which I don't think is possible infront of a mod_dav_svn service) or mod_dav & davfs etc... (can I provide read only mod_dav access infront of mod rewrite infront of mod_dav_svn??!?!)]



share|improve this question

I'm not sure I read you right, but if all you need to do is have local repository access form scripts running on the same box, you can use the file:// URI scheme with the svn command-line tool:

svn info -r <rev> file:///var/svn/repo/rev4235/project/trunk/file.c

Most svn commands will work on this and you can even commit to it, so long as the user has write access to the repository filesystem. This should work regardless of the DB backend you choose for your repository.

Note that this bypasses authentication if that happens to be configured elsewhere (such as in the apache config); which could be an issue, depending on your environment.

share|improve this answer
Not really. You comments are certainly useful, but I'm after a way of reading a file direct from subversion as if it were a local file on disk, having to take no special measures at all at the point of access to get it. no scripts, no commands, just open the file. As above, svnfs does exactly this, but only for the current revision. – Chris Phillips Nov 23 '10 at 18:42
up vote 1 down vote accepted

Hmm, well this is yet another example of not understanding my own requirements from not knowing SVN nearly as well as I really need to. I just needed to create tags of each version I would want to access, and then there's no need to ever hack around the back to reach a specific revision. No wonder things don't make sense to some people when my requirements are only defying conventions and largely redundant.

Thanks for the responses though, appreciated

share|improve this answer

You could slurp the repo into git (long one-time import):

git svn clone -s file:///var/svn/repo/project

And use git fs to access the contents.

git fs
cd .git/fs/HEAD/log
cd ~rev/worktree
cat file.c

Disclaimer: git fs is my work.

share|improve this answer
You bugger! I was trying to stay happy using SVN and resisting the feeling that I should possibly look at git instead..! Thanks, certainly interesting to know about it for the future, but changing wouldn't be an option right now. – Chris Phillips Nov 23 '10 at 21:18
really? what happens if you try to access a historical revision? – gbjbaanb Nov 25 '10 at 11:55
@gbjbaanb The git repository has all revisions local. To access a file in any revision, git reads a range of delta-compressed data from a packfile. This tends to be much faster than contacting a remote server. – Gabriel Nov 25 '10 at 19:41
you know... I knew that, all DVCSs store everything locally. Ignore my momentary lapse - but leave the comment as its still informative. – gbjbaanb Dec 1 '10 at 12:01

No, there's no way to do this with the SVN FS. It stores all deltas in files in the repo/db/ folder, 1 file per changeset that includes all the deltas for each changed file. If you run svnadmin pack occasionally, these files will all be packaged together into a single file eventually (when you get to 1000 files in the directory).

So.. no, there's no filesystem way of getting to a whole file by browsing the repository storage.

However - you can access SVN over webdav, or the file:// URI. I'm not sure if you can have mod_dav read only and mod_dav_svn read-write (you can have RW access to svn HEAD using webdav). I think the best way is to use the file mechanism for scripts, its not difficult to use it via SVN commands.

share|improve this answer

Why not simply use svnFS. It's all in all what you are looking for.

At least it's easier than migrating the repo over to git, just to use git fs.

share|improve this answer
Well this doesn't answer the question I asked, but it turns out I was asking the wrong question... If I wanted to access an old revision, then I should just be copying that revision to a tag, and then it's still naturally available within the current revision under /tags/revision123 etc... – Chris Phillips Nov 27 '10 at 12:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.