Getting present working view in Clearcase

倾然丶 夕夏残阳落幕 提交于 2019-12-22 00:16:39

问题


I need to find a command to get the active view name from Clearcase, so I can ask the user if they would like to set that as their default path. The following does not work. Any options besides this?

out, err = subprocess.Popen([r"cleartool", "xxx", "-xxxxx"],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE).communicate()
return out

回答1:


cleartool pwv will only give you the name of the view.
To get the path:

cleartool pwv -root

G:\ means probably a snapshot view, since all dynamic views are usually mounted (MVFS) on the drive M:\ by default (but they could be subst'ed to a drive letter as well).
For snapshot views, a drive letter different from C:\ means the actual path of the snapshot view has been subst (Windows command) to a drive letter in order to shorten its path.

See "To use the subst command to access snapshot views (Windows)"

Assigning a snapshot view root directory to a drive letter with the subst command provides slightly better performance than making the snapshot view a shared directory

So if you are on G:\norbt5_ed_hil_dev and want the full path after a cleartool pwv, you can:

cleartool pwv -root

If that returns you only G:\, then you need to call the commands subst to see the full path where G:\ has been assigned.

subst

Or, in python (as in the example):

os.system('subst')

And parse the result.


Note: As explained in "Python and ClearCase setview", pwv wouldn't work in a dynamic view started with setview on Unix (setview doesn't exist on Windows), because it creates a sub-process.
If you are on Unix working with dynamic view, don't use setview (as illustrated here).
Always use cleartool startview <view_tag>, and then the full path of the dynamic view:

/view/AViewName/vobs/aVob/...

A cleartool pwv -root would then return /view/AViewName.


On Windows, if cleartool pwv is used in a dynamic view, then the name of the view returned by cleartool pwv -short is enough:

The path of the root folder of a dynamic view on Windows is always:

m:\view_tag

even if the view has been subst to a different drive letter.
You don't need the -root.




回答2:


cleartool pwv is the command to see the active view name. cleartool pwv -short gives a nicer output.



来源:https://stackoverflow.com/questions/24267665/getting-present-working-view-in-clearcase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!