Monday, December 01, 2008

svn externals

It often useful to link to an external resource within a svn project.

for instance you may store Wsdl and Xsd files in one location, but your implementation code may need to access it. You don't want to copy and paste it since you will end up with 2 copies to maintain.

for these cases you can use svn externals to link to an external svn directory (note only directories can be linked to, not individual files)

e.g. (I set svn:externals via eclipse)

Use Team> Set Property > [select svn:externals]
Enter the name of the directory link you want, (a revision number if required, e.g. -r123), followed by the remote directory to link to.

wsdl [-r rev] http://svnHost/repos/trunk/MyProject/myDir1/wsdl

xsd [-r rev] http://svnHost/repos/trunk/MyProject/myDir1/xsd

SVN Ignore
Svn can be instructed to ignore certain files etc.

For example when working with eclipse projects you will want to specify that .classpath, and .project files will not be included in svn, checkin's or diff's.

Ignores can be setup globally or per directory.

This can be done via eclipse (in the windows/ preferences/ Team control),

or find your subversion config file. e.g. ~/.subversion/config then edit the following line, e.g.

global-ignores = .project .claspath *.o *.lo *.la #*# .*.rej *.tmproj

cd to project directory,
svn propset svn:ignore "target/*

This should ignore the target directory (e.g. for maven builds)

No comments: