遵循SVN中的符号链接 [英] Follow symlinks in SVN

查看:523
本文介绍了遵循SVN中的符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个linux目录(不需要任何Windows检出):

I have a linux directory (and don't need any windows checkout):

/home/me/projects/project1

在此项目中,我需要SVN(1.8.8)才能跟随符号链接"link1":

In this project, I need SVN (1.8.8) to follow a symlink "link1":

/home/me/projects/project1/link1/<some_directories_and_files>

但是SVN不允许我这样做,它只是添加link1而不是其内容.如果我尝试添加其内容,则会收到错误消息:

But SVN won't let me do that, it just add link1 but not its content. If I try to add its content, I get an error:

svn add link1/*
svn: E145001: Can't schedule an addition of '/home/me/projects/project1/link1/first_directory' below a not-directory node

我尝试将link1转换为硬链接,但我也不能这样做:

I tried converting link1 to hard link but I can't do that either:

ln /path/to/my/linked/directory link1
ln: ‘/path/to/my/linked/directory’: hard link not allowed for directory

有什么主意吗?您如何处理这种配置?我只需要从简单的svn commit

Any idea? How do you handle this kind of configuration? I just need to commit everything from /home/me/projects/project1 from a simple svn commit

推荐答案

如果我了解您的问题,则您有:

If I understand your problem, you have:

project1/
project1/link1 -> ../../some/where/else

如果您做一个简单的svn add link1,它将向subversion存储库添加一个符号链接条目,但是您要完成的工作是将其他位置的内容放入树中.

If you do a simple svn add link1 it adds a symlink entry to the subversion repository, but what you're trying to accomplish is getting the stuff under somewhere else into the tree.

如果是这种情况,那么您的工作方向错误,则应在链接1下创建真实的文件和目录,并将目标位置符号链接到链接1目录中.那将是解决问题的简单方法.

If this is the case, then you're fighting in the wrong direction, you should make the real files and directories under link1, and make the target locations symlinks into the link1 directory. That would be a simple solution to the problem.

另一种解决方案是将位置../../some/where/else本身设置为svn位置,并使link1成为该位​​置的外部定义.当您在主目录中提交时,将同时提交外部对象,这将实现信息的存储.但是,要确保其他位置保持同步,您必须确保将其更新为与存储数据相同的版本.

Another solution would be to make the location ../../some/where/else an svn location in it's own right, and make link1 an externals definition to that location. When you commit in the main directory, the externals would be committed at the same time which would achieve storing the information; however to ensure that the other location was kept in sync, you would have to make sure to update it to the same version as the stored data.

在我的桌面上,我有一个设置目录:

In my case, on my desktop, I have a settings directory:

$HOME/settings

这是包含.bashrc.profile.vimrc.vim等文件和文件夹的目录的已检出副本,来自svn存储库.我所有的配置文件和目录都是此文件夹中的符号链接,例如.profile-> settings/.profile等.当我进行更改时,它们会反映在svn树中,我可以将其提交回以确保当我转到另一个系统时,我不会丢失配置设置.

This is a checked out copy of a directory containing .bashrc, .profile, .vimrc, .vim, etc. files and folders from an svn repo. All my profile files and directories were symlinks into this folder, so for example .profile -> settings/.profile, etc. When I make changes, they are reflected in the svn tree, which I can commit back to in order to ensure that I don't lose my config settings when I go to another system.

如果您真的希望svn遵循符号链接作为硬链接(您不能进行目录硬链接,因为这将是坏事™),那么您将不得不破解svn客户端源,因此它做到了你想要的;但这将是一场维护噩梦.

If you really want svn to follow symlinks as hardlinks (You can't make directory hardlinks because it would be a bad thing™), then you'll have to hack the svn client source so that it did what you wanted; but this would be a maintenance nightmare.

可以逃脱将符号链接变成指向目标的绑定安装点的问题,但这有其自身的问题-您必须是root用户才能完成此任务,最终结果是离开您的/proc/mounts中的有趣条目即可完成此操作:

You could get away with making the symlink into a bind mount point directed at the target, but that has it's own issues - you would need to be root to accomplish this, and it ends up leaving funny entries in your /proc/mounts to accomplish this:

mount --bind /absolute/path/to/some/where/else project1/link1

这篇关于遵循SVN中的符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆