How do I perform a recursive checkout using ClearCase?
Asked Answered
B

2

12

I want to check out all files in all subdirectories of a specified folder.

(And it is painful to do this using the GUI, because there is no recursive checkout option).

Biform answered 28/8, 2008 at 22:44 Comment(0)
H
24

Beware: ClearCase is File-centric, not repository centric (like SVN or CVS).

That means it is rarely a good solution to checkout all files (and it can be fairly long with ClearCase ;) )

That being said, the question is perfectly legitimate and I would like to point out another way:

open a cleartool session in the 'specified folder':

c:\MyFolder> cleartool
cleartool> co -c "Reason for massive checkout" .../*

does the trick too. But as the aku's answer, it does checkout everything: files and directories... and you may most not need to checkout directories!

cleartool find somedir -type f -exec "cleartool checkout -c \"Reason for massive checkout\" \"%CLEARCASE_PN%\""

would only checkout files...

Now the problem is to checkin everything that has changed. It is problematic since often not everything has changed, and CleaCase will trigger an error message when trying to check in an identical file. Meaning you will need 2 commands:

ct lsco -r -cvi -fmt "ci -nc \"%n\"\n" | ct
ct lsco -r -cvi -fmt "unco -rm %n\n" | ct

(with 'ct being 'cleartool' : type 'doskey ct=cleartool $*' on Windows to set that alias)

Note that ct ci -nc will check-in with the comment used for the checkout stage.
So it is not a checkin without a comment (like the -nc option -- or "no comment" -- could make believe).

Hepato answered 23/9, 2008 at 7:32 Comment(0)
C
8
cleartool find somedir -exec "cleartool checkout -nc \"%CLEARCASE_PN%\""

Also an article "ClearCase: The ten best scripts" might be helpful

Chrissychrist answered 28/8, 2008 at 23:7 Comment(2)
If you are using Linux, replace %CLEARCASE_PN% with $CLEARCASE_PNStavro
@Stavro Good point. CLEARCASE_PN (for PathName) or CLEARCASE_XPN are both environment variables set by clearcase scripts (cleartool find for instance). The Windows syntax (%...%) or Unix syntax ($...) is in effect for them.Hepato

© 2022 - 2024 — McMap. All rights reserved.