1

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
isakbob
  • 1,439
  • 2
  • 17
  • 39
  • Is there a reason you can't just remove the temporary view at the end of the script? That will remove all the checkout references without risking leaving a view in an unstable state. – Brian Cowan Jun 06 '19 at 13:08

1 Answers1

1

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This answer is useful, but I am working in bash. (I will edit my question accordingly). – isakbob Jun 05 '19 at 18:00
  • @isakbob in bash on Windows or on Linux? – VonC Jun 05 '19 at 18:02
  • In bash on linux. – isakbob Jun 05 '19 at 18:05
  • I'm close, but I'm getting an "Unmatched ". Is there a quote in there that is somehow not getting escaped? – isakbob Jun 05 '19 at 18:27
  • @isakbob That is possible: I don't have the environment to test it: check the output of `cleartool descr -l vob:/vobs/aVob|grep TMP_` to determine if the gsub does it work. An alternative syntax would be using strong quotes: `gawk '{gsub(/]/,"",$3); print "cleartool rmview -uuid "$3}'` – VonC Jun 05 '19 at 18:32
  • @VonC I would personally recommend against using rmview -uuid when the view still exists. I would recommend removing the view completely in this instance since the views are getting created (and presumably eventually removed) by and for the script that is being tested. Depending on the scripting language in use, it should be relatively simple to jump to the end of the script, where a normal cleartool rmview command resides. – Brian Cowan Jun 06 '19 at 13:05
  • @BrianCowan I agree (and I can't remember, but I believe you did warn me against that approach in the past). I have received other warning before (https://stackoverflow.com/a/29961834/6309) – VonC Jun 06 '19 at 20:01