Posts

Showing posts from February, 2014

Perforce: Delete empty change lists using Python

Image
Some of the tools I've written allow a user to check out chains of files- like Maya files as well as any exported FBX files and their unity metadata etc, all in one nice pass. This is great, but it has one annoying side effect. If the user presses the button twice the files are added to another change list, but the one they were just in stays there, empty. Press it a number of times and suddenly you have an army of zombie phantom changelists whose only purpose is to clutter up your pending list and annoy you.  I have been using the P4Python API and found it to be... well... its kinda crap. It would be great if it had a 'delete all empty pending changelists' function, but it doesn't seem to. So I wrote one of my own.  Beware! If you don't like hacking output out of strings the following code will make you cringe...  There's my target... import subprocess """Get a list of changelists from the command line. Try to delete them (will delete if empty)&q