问题
I have a Subversion repository that contains some client files. Some clients will use the standard files, but other clients will provide custom versions of the files. To accommodate this, I've used svn:externals for the clients that will use the shared files. So our structure is something like this:
svn
|+ top
|+ shared
|+ clients
|+ custom1
|+ custom2
|+ shared1
|+ shared2
The client "custom1" is a real folder in Subversion containing that client's customized files, and the client "shared1" is an svn:external property on the /clients
folder which points to /top/shared
.
What I was hoping for was that when I want to deploy a new client, I could simply export their folder to the server, using a command like:
svn export http://svn/top/clients/custom1 \\server\custom1
or
svn export http://svn/top/clients/shared1 \\server\shared1
This works fine for the customized clients because they have a "real" folder in Svn, but for the clients configured with externals, I get an error:
svn: E170000: URL 'http://svn/top/clients/shared1' doesn't exist
Is there a way that I can check out/export an "external" folder directly?
回答1:
http://svn/top/clients/shared1
is not a physical path in SVN but just a reference to your external. So, that is the reason you are not able to check out that directly.
To get rid of this, you can create http://svn/top/clients/shared1
as an empty folder in SVN and you can give the svn:external property on the http://svn/top/clients/shared1
folder to mke it point to /top/shared
instead of /clients
folder.
Then your check out will get a physical path to check out but you don't need to keep your actual content under this folder.
回答2:
What I ended up doing was using svn ls to see if I was accessing a physical directory. If it didn't exist then used the following command to get the target of my external:
svn propget svn:externals http://svn/top/clients/ | findstr "\<shared1\>" | sed "s/\(.*\)\s\(shared1\)/\1/"
findstr
will get the single line for the property I'm looking for, and the sed
command will parse out the target url (the part before the space).
来源:https://stackoverflow.com/questions/14840720/how-to-check-out-svn-external-url-directly