tags:

views:

183

answers:

3

I need help on below requirement.

I have a extracted report where I used to get "revision number", element details, version path, changeset.

I need to:

  1. Create a temporary directory using a Perl script for each revision.

  2. Do an unreserved check out for the each element map with each revision and put into the created temporary folders.

I am able to create the temporary directory (e.g-for 100 revision number able to create 100 folders) but need help to write piece of code to do a unreserved checkout (prior to this create activity, set activity) each element associated with the each revision and put the file into the particular created folder. Also implement a undo unreserve checkout after the successful copy.

The data are like,

Revision#       Element                    version_path            changeset
-------  ---------------------------     ---------------          ------------
1  C:\views\xyz_mn-11\gahdg\test.java    \main\sdgks-1111_Int\3"  "C:\views\xyz_mn-11 
                                                               \gahdg\test.java@@\main
                                                                \sdgks-1111_Int\3"         
2
3
4

Please give some suggestions or valuable guidance on this.

+2  A: 

One way to execute an external command from Perl is to use system:

my $cmd = 'cleartool checkout -unr -nc -out -ver \main\sdgks-1111_Int\3 test.java';
if (system $cmd) {
    die "Error: $cmd";
}
toolic
+1  A: 

Check also the question How can I interact with ClearCase from Perl?, where you will be able to execute cleartool command in Perl with the CCCmd package.

CCCmd::ClearToolNoError("cleartool checkout -unr -nc -out -ver \main\sdgks-1111_Int\3 test.java");

However, after reading checkout man page, I am not sure this is the right syntax

cleartool checkout -unr -nc -out /my/temp/file -ver test.java@@\main\sdgks-1111_Int\3

would be more like it, using the extended pathname form to reference the right version to checkout from test.java.

VonC
A: 

Thank you guys verymuch.I tried this but now trying to do only copy the file in the element path(test.java) to a destination folder.Any idea on this.So far I have tried foreach $element(@element) { system-("copy "$element" \"$destination\""); } But the problem is it is not copying a particular file,copying the whole directory & also I am getting the system messages(like-1 files copied)at the report(as I am using $element) to create report.Is there any way to get rid of this?

devtech
Do not put additions into the answer area. Instead edit your question, or ask a new one.
daxim