如何:移动符号链接并保持目标

发布于 2024-12-04 10:21:08 字数 954 浏览 0 评论 0原文

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

正如我的上一个问题中所述,这并不是那么简单正如它听起来(对我来说),因为目标路径是相对于链接本身保存的,而不是相对于 VOB 根或类似的东西保存的。如果 ClearCase 会调整这些链接中的路径信息,这不会是一个大问题,但从表面上看,它不会。

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

/myVOB
  /Originals
  /LinksA
    /SubDir
  /LinksB

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

有谁知道是否可以告诉 ClearCase 在移动符号链接时调整路径?通常我认为这应该是开箱即用的,但人们永远不会知道 ClearCase...尽管如此,也许有人可以尝试重现这一点并告诉我它是否成功,也许这只是我系统上的一个错误?

编辑:好的,看起来不支持开箱即用的移动相对符号链接。我是否需要移动大量符号链接,我现在正在编写一个脚本,该脚本需要许多文件/目录并将它们移动到新位置。如果它遇到符号链接(其目标可能是文件或目录),它不会只调用cleartool mv 或其他命令,而是遵循 VonC 发布的过程。

但我不这样做,所以我可能会手动完成此操作。也许有人已经写了这样的脚本,那么这将是推广它的正确地方;)

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 ;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

硪扪都還晓 2024-12-11 10:21:08

如果您考虑有关“如何在 ClearCase 互操作中管理符号链接”的技术说明,看来:
(即使您不在互操作环境中,即即使您的 Windows 视图和 Vob 服务器都在 Windows 上)

  • 符号链接正在使用主要相对路径,
  • 如果目标路径发生更改,您必须重新创建它们。

如何更改 VOB 符号链接路径

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

注意:如果 VOB 符号链接是使用绝对路径创建的,则无法使用相对路径来编辑(修改)该链接。

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

示例:

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

注释

建议您使用相对VOB符号链接而不是绝对符号链接
绝对 VOB 符号链接要求您使用视图标记级别的绝对路径名,例如 \view-tag\VOB-tag\filename
因此,它们仅在创建它们的视图中有效

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文