开发者

How To: move symlink keeping the target

开发者 https://www.devze.com 2023-04-04 15:48 出处:网络
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 it

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.

0

精彩评论

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

关注公众号