views:

46

answers:

1
+1  Q: 

cleartool question

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

A: 

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
VonC
Note: if you want to get back test.txt in your folder, you can use a subtractive merge: http://stackoverflow.com/questions/1636712/evil-twin-problem-and-subtractive-merge/1637405#1637405
VonC
Thanks VonC, 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...
chuanose
@chuanose: I have edited my answer to address your issue.
VonC
The sequence I was thinking of doesn't seem like an evil twin. You have test.txt originally in testFolder, and in clearexplorer you move test.txt to testFolder2. When you lshistory it shows two events, one checkin to testFolder that removes test.txt, and second checkin to testFolder2 that adds test.txt. However it is the same test.txt object throughout.
chuanose