3

First, I would like to clarify a quick question I have, am I right in thinking that files in svn repo don't actually exist in the heirarchical structure you see when you check them out?

I have tried to use svn export ~/svn/project1 ~/public_html/project1 but it didn't work.

What I actually want is to have the export command automatically executed when I do a commit so that I can see my changes immediately in a web browser.

Matt
  • 9,068
  • 12
  • 64
  • 84

2 Answers2

2

am I right in thinking that files in svn repo don't actually exist in the heirarchical structure you see when you check them out

Correct... they actually exist in a DB of sorts in the repository directory. However you can invoke svn export on a working copy or a respoitory url. So lets say your repo is on the system at /svn/myproject and you have a working copy of trunk at ~/myproject then either of the folloring commabds will export properly:

svn export --force ~/myproject ~/public_html

svn export --force file:///svn/myproject/trunk ~/public_html

ofcourse you can subsitute the svn, http, or svn+ssh for the file protocol depending on how your access is set up.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • What specific problems does the `--force` deal wit? I had an issue with export already: `svn export ~/public_html/svnmfr svn: '/home/firefli/public_html/svnmfr' is not a working copy` – Matt Jan 25 '10 at 16:46
  • if `public_html` already exists the force flag will make the export overwrite it... otherwise it will complain that the directory already exists. The error you got means that whatever you tried to export wasnt in fact a subversion working copy - export is only invokable on working copies or a repository. – prodigitalson Jan 25 '10 at 17:00
  • do a checkout. if its a public server though youll want to make the `.svn` directories unaccessible with a `.htaccess` – prodigitalson Jan 25 '10 at 19:44
  • So I will have the actual versioned code in some folder, a checked out copy somewhere else on the server, _and_ a copy that's exported to public_html? – Matt Jan 25 '10 at 19:51
  • 2
    No, you don't make a checkout on the server. You can export directly from the repository, which is what you want to do...not export from a working copy. – Michael Hackner Jan 25 '10 at 22:33
1

Yes; see Where are my svn files?

Automatically exporting can be done with a post-commit hook.

Community
  • 1
  • 1
Michael Hackner
  • 8,605
  • 2
  • 27
  • 29
  • Where do I put the post commit hook? I have a repo on a linux server and I'm committing to it from my windows box. I need the hook to export from the repo to another directory on the linux server. – Matt Jan 25 '10 at 19:20
  • @Matt: Youll need access to svnadmin for that i think - are you an admin level user on this server or is svn running out of your user home? – prodigitalson Jan 25 '10 at 19:46
  • svn is running from /home/user yeah – Matt Jan 25 '10 at 19:50