I guess the title sufficiently sums up my question. I have working code to automatically check out a file:
p = Popen(['cleartool', 'co', pathname], stdin = PIPE)
p.communicate('comment for checkout')
I'm wondering how to check if the file is already checked out before executing this. Thanks in advance everyone!
You can parse the output of a
cleartool ls -short pathname
If checked out, its version will end with
/CHECKEDOUT
.Or you can go ahead, try to check out and test the exit status of the command. But there could be other causes for failure (other than "already checked out")