Search code examples
clearcase

How can I uncheckout a file in all of my temporary views in command line?


Background

I currently am testing a script that creates a temporary view and checks out four package files to be updated by a process. However, my script hasn't gotten to the point where it can reach the uncheckout step. This results in 30+ temporary views that all contain a checkedout version of the package files.

Attempted solution

I could go in to the graphical clearcase tree and manually ctrl-click all the temp views that are checked out, then click on the uncheckout button. However, this will get unweildy after a few hundred tests, so I want to know of a command line way to do this. All of my temporary views are formatted with "TMP_abc_QUA_###".

Question

How can I uncheckout a file across all temporary views from linux command line with bash?


Solution

  • As described in "How to remove checked-out references of a view from a VOB", you can simply describe a vob:

     cleartool describe -long vob:\baseccvob
    

    You will see which views are holding objects:

    VOB holds objects from the following views:
    MYHOST:C:\VIEW\TEST.vws [uuid a7fc590.42f34d53.ae68.b6:30:f5:30:c5:a4]
    

    For each views which are part of your temporary views, you can do:

    cd /aview/aVob
    cleartool rmview -uuid fa7fc590.42f34d53.ae68.b6:30:f5:30:c5:a4 
    

    That will remove any checkout status for any file in aVob for that view.

    Loop and repeat for other temp views.

    I used in the past (Windows syntax)

    cd M:\aview\avob
    ct descr -l vob:\aVob|grep TMP_|gawk "{gsub(/]/,\"\",$3); print \"cleartool rmview -uuid \"$3}"|cmd
    

    On Linux:

    cd /views/aView/vobs/aVob
    cleartool descr -l vob:/vobs/aVob|grep TMP_|gawk "{gsub(/]/,\"\",$3); print \"cleartool rmview -uuid \"$3}"|sh