问题
I\'m using the ClearCase Automation Library (CAL) in a tool that helps me keep track of unintegrated changes; now I\'d like to extend the tool so I can also make checkins through it.
For this feature, I need to find the local copy of a Snapshot View. While I can ask CC which View is attached to a certain directory, I cannot seem to find a function to look up the local directory for a given View; also it appears as if the most reliable method to find out whether a Snapshot View exists locally is to compare the HostName property against the local computer name.
So: Given the IClearCase interface, how can I find all directories in which Snapshot Views exist?
回答1:
I confirm that you cannot find the root directory of a snapshot view only knowing its view tag: a snapshot view can be loaded in several separate directories if you want.
The only link between your snapshot view and its root directory is the .view.dat
hidden file which contains the uid of the view.
Plus, the hostname attached to a view has nothing to do with the fact it is loaded or not on a computer. It is the name of the view server (which can be your own desktop, or can be a centralized server). It is on that server that the view.exe
process managing all ClearCase-related operations for that view.
So, with your script (like for instance a perl script), you don't really need CAL at first to find that view: you need first to be able to look the the view.dat
file, extract the uid, and then check if it is the same than the view uid (lsview -l -full -pro) you are looking for.
来源:https://stackoverflow.com/questions/7917295/find-local-copy-of-files-in-snapshot-view