开发者

Create link file in SVN

开发者 https://www.devze.com 2023-04-06 13:32 出处:网络
I use SVN on Windows XP. Situation: SVN as document archive. I have a few files that need to be organized into various folders and yet retain the orginal file structure.

I use SVN on Windows XP.

Situation: SVN as document archive. I have a few files that need to be organized into various folders and yet retain the orginal file structure.

Example: In a folder called "Templates"

File1.doc
File2.doc
File3.xls
File4.xls

Now, I want these to be organized in different folders:

Templates\Type1
      File1.doc -> ..\File1.doc
      File2.doc -> ..\File2.doc
      File3.xls -> ..\File3.xls

Templates\Type2
      File1.doc -> ..\File2.doc
      File2.doc -> ..\Fil开发者_如何转开发e1.doc
      File3.xls -> ..\File4.xls

When the files in the Templates folder are modified, the files in the Type* folders point to the right file.

How can I achieve this in SVN? Is there any other alternative way to do this?


Take a look at the subversion documentation on symbolic links here.

Quote from linked page, emphasis mine:

Versioning Symbolic Links

On non-Windows platforms, Subversion is able to version files of the special type symbolic link (or “symlink”). A symlink is a file that acts as a sort of transparent reference to some other object in the filesystem, allowing programs to read and write to those objects indirectly by way of performing operations on the symlink itself.

When a symlink is committed into a Subversion repository, Subversion remembers that the file was in fact a symlink, as well as the object to which the symlink “points.” When that symlink is checked out to another working copy on a non-Windows system, Subversion reconstructs a real filesystem-level symbolic link from the versioned symlink. But that doesn't in any way limit the usability of working copies on systems such as Windows that do not support symlinks. On such systems, Subversion simply creates a regular text file whose contents are the path to which to the original symlink pointed. While that file can't be used as a symlink on a Windows system, it also won't prevent Windows users from performing their other Subversion-related activities.


You can do software links in subversion using file externals.

Add svn:external property to the folder you want your files in. The property should look like this:

..\File1.doc  File1.doc
..\File2.doc  File2.doc
..\File3.xls  File4.xls

The first column is the path to original file. The second column is the local name of the file.

Warning In your working copy these files won't be synchronized. I.e if you change one of them, the second won't change until you commit the changes and update your working copy. If you will change both files, it will create a conflict and you won't be able to commit.

0

精彩评论

暂无评论...
验证码 换一张
取 消