Monday, February 16, 2009

Files shared among SVN repositories or projects.

1. Create an folder 'IncludeShare' in project COM as below

+---COM
| +---Include
| +---IncludeShare
| +---Sources
|
\---DAQ
+---Include
+---IncludeShare (appear after update project from repository)
+---Sources

2. Choose properties for DAQ project in SVN right click menu
3. Click 'ADD' Button and select 'svn:externals' in the drop down list of 'property name'.
4. type text in the edit box
'IncludeShare https://JUPITER:8443/svn/CableTracker/trunk/Firmware/COM/IncludeShare'
5. click 'OK' to close all pop up windows.
6. Update project 'DAQ' using SVN menu, then you will see '\IncludeShare' appeared under DAQ project.
7. Check the SVN revision of \DAQ\IncludeShare, you will see that it's pointing to COM project.


Details, you can refer to tortoise help:

5.2.4. Referenced Projects

Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations in a repository, or perhaps from different repositories altogether. If you want every user to have the same layout, you can define the svn:externals properties.

Let's say you check out a working copy of /project1 to D:\dev\project1. Select the folder D:\dev\project1, right click and choose Windows Menu ¡รบ Properties from the context menu. The Properties Dialog comes up. Then go to the Subversion tab. There, you can set properties. Select the svn:externals property from the combobox and write in the edit box the repository url in the format name url or if you want to specify a particular revision, name -rREV url You can add multiple external projects, 1 per line. Note that URLs must be properly escaped or they will not work properly. For example you must replace each space with %20. Note that it is not possible to use foldernames with spaces in them. Suppose that you have set these properties on D:\dev\project1:

sounds http://sounds.red-bean.com/repos
quick_graphs http://graphics.red-bean.com/repos/fast%20graphics
skins/toolkit -r21 http://svn.red-bean.com/repos/skin-maker

Now click Set and commit your changes. When you (or any other user) update your working copy, Subversion will create a subfolder D:\dev\project1\sounds and checkout the sounds project, another subfolder D:\dev\project1\quick graphs containing the graphics project, and finally a nested subfolder D:\dev\project1\skins\toolkit containing revision 21 of the skin-maker project.

If the external project is in the same repository, any changes you make there there will be included in the commit list when you commit your main project.

If the external project is in a different repository, any changes you make to the external project will be notified when you commit the main project, but you have to commit those external changes separately.

Note that if you change the URL in an svn:externals property, then next time you update your working copy Subversion will delete the old external folder and make a fresh checkout, so you will see files being Added, rather than being Updated as you might have expected. This situation might occur if you reference a tag from another project. When a new version of that project is released, you change your external reference to point to the new tag.

No comments: