作法:移动符号连结保持目标 [英] How To: move symlink keeping the target

查看:68
本文介绍了作法:移动符号连结保持目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在动态视图中的VOB中移动多个符号链接。



如我的上一个问题,这听起来并不简单(对我来说),因为相对于链接保存了目标路径本身,而不是VOB根目录或类似名称。如果ClearCase可以调整那些链接中的路径信息,但这并不是什么大问题,但是显然,它不会。



详细信息:假设以下文件夹结构:

  / myVOB 
/ Originals
/ LinksA
/ SubDir
/ LinksB

然后将链接移动到文件 myVOB / Originals / readme.txt 位于 myVOB / LinksB myVOB / LinksA / SubDir 的位置,将阻止链接到找到它的目标,因为它正在寻找 myVOB / LinksA / SubDir /../ Originals / readme.txt



有人知道在移动符号链接时是否可以告诉ClearCase调整路径吗?通常,我认为这应该是开箱即用的,但是人们对ClearCase还是一无所知……但是,也许有人可以尝试重现它并告诉我它是否成功,也许这只是我系统上的一个错误? / p>

编辑:确定,因此看来不支持即兴移动相对符号链接。我是否需要移动大量符号链接,我现在正在编写一个脚本,该脚本使用了许多文件/目录并将它们移动到新位置。如果遇到符号链接(目标可能是文件或目录),则它不仅会调用 cleartool mv 之类的方法,还会遵循VonC发布的步骤。



但是我没有,所以我可能会手工完成。也许有人已经写过这样的脚本,那么这将是推广它的合适地方;)

解决方案

如果您考虑以下<关于如何在ClearCase互操作中管理符号链接的href = https://www-304.ibm.com/support/docview.wss?uid=swg21118146 rel = nofollow>技术说明

(即使您不在互操作环境中,即使您的Windows视图和Vob服务器都在Windows上也是如此)




  • 符号链接使用主要相对路径

  • 如果目标路径更改,则必须重新创建它们。




如何更改VOB符号链接路径



唯一的方法修改到相对路径的VOB符号链接就是创建一个新的符号链接



注意:如果出现以下情况,则不能编辑(修订)VOB符号链接:它是使用绝对路径来利用相对路径创建的。



-Che确认目录
-使用 cleartool rmelem 命令删除旧的VOB链接
-创建一个具有相同名称的新链接



示例:




  cleartool ln -slink -nc ../../same_file_name.txt 
检入目录




注释



建议您使用相对的VOB符号链接而不是绝对符号链接

绝对VOB符号链接要求您使用视图标记级别的绝对路径名,例如 \view-tag\VOB-tag\filename

因此,它们仅在创建它们的视图中有效



I need to move multiple symlinks within a VOB in a dynamic view.

As described in my previous question, this is not as trivial as it sounds (to me), as the target path is saved relative to the link itself and not to the VOB root or anything like that. This wouldn't be a big issue, if ClearCase would adjust the path information in those links, but appearantly, it does not.

Details: Let's assume following folder structure:

/myVOB
  /Originals
  /LinksA
    /SubDir
  /LinksB

Then moving a link to the file myVOB/Originals/readme.txt that is located in myVOB/LinksB to myVOB/LinksA/SubDir will prevent the link to find its target, as it is looking for myVOB/LinksA/SubDir/../Originals/readme.txt.

Does anyone know if it is possible to tell ClearCase to adjust the paths when moving symlinks? Usually I would think this should be done out of the box, but one never knows with ClearCase... Nevertheless, perhaps someone could try to reproduce this and tell me if it succeeded or not, perhaps it's just a bug on my system?

Edit: OK, so it looks like moving relative symlinks is not supported out-of-the-box. Would I need to move a great number of symlinks, I'd be writing a script right now that took a number of files/directories and moved them to a new location. If it encountered a symlink (whose target may be a file or directory) it would not just call cleartool mv or whatever, but follow the procedure as posted by VonC.

But I don't, so I'll probably do this by hand. Perhaps someone already wrote such a script, then this would be the right place to promote it ;)

解决方案

If you consider this technote on "How to Manage symbolic links in ClearCase interop, it seems that:
(even if you aren't in an interop environment, ie even if your Windows views and Vob server are both on Windows)

  • symlinks are using primary relative path
  • you must recreate them if the target path change.

How to change a VOB symbolic link path

The only way to revise a VOB symbolic link to a relative path is to create a new symbolic link:

Note: You cannot edit (revise) a VOB symbolic link if it has been created using an absolute path to utilize a relative path.

-Check out the directory - Remove the old VOB link using the cleartool rmelem command - Create a new link with the same name

Example:

cleartool ln -slink -nc ../../same_file_name.txt
Check in the directory

Notes:

It is recommended that you use relative VOB symbolic links instead of absolute symbolic links.
The absolute VOB symbolic link requires you to use absolute path names from the view-tag level, for example, \view-tag\VOB-tag\filename.
Hence, they are valid only in the view in which they were created.

这篇关于作法:移动符号连结保持目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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