cleartool question

2020-02-07 07:28发布

问题:

Lets say I have a directory at \testfolder, and the latest is currently at /main/10. I know that the operation resulting in testfolder@@/main/6 is to remove a file named test.txt.

What's a sequence of cleartool operations that can be done in a script that will take "testfolder@@/main/6" and "test.txt" as input, and will cat out the contents of test.txt as of that time?

One way I can think of is to get the time of /main/6 operation, create a view with config spec -time set to that time, and then cat the test.txt at the directory. But I'm wondering if I can do this in a easier way that doesn't involve manipulating config specs, perhaps through "cleartool find" and extended path names

回答1:

If you are using a dynamic view, you should be explore directly the extended pathnames of testfolder in order to access the content of test.txt.

cd m:\myview\myVob\path\to\testfolder

# In version 5 of testfolder, test.txt was still there
cd @@/main/5 

# Note: test.txt is a directory! only LATEST is a file
type test.txt@/main/LATEST 

The OP adds:

how about if test.txt was moved from testFolder to testFolder2, and then a new version of test.txt is checked in? In this when I go into testfolder@@/main/5, test.txt@@/main/LATEST is incorrect...

Technically, this is a case of evil twins: 2 objects of the same names exists (one in testfolder@@/main/5, one in testfolder@@/main/10) with different history.

You need, to get back the former test.txt (a like rollbacking a file), remove your current test.txt and get back the old one currently moved to Folder2. (cleartool move)

 cd testFolder2
 cleartool checkout -c "move test.txt back to testFolder"
 cd ../testFolder
 cleartool checkout -c "get back test.txt from testFolder2"  
 cleartool rmname test.txt
 cleartool move ../testFolder2/test.txt
 cleartool ci -nc .
 cleartool ci -nc ../testFolder2