Wednesday, June 25, 2008

Perforce and figuring out what you've got

Perforce can be pretty great. And sometimes it can be just ass. Here's an example:
I want to know what my current changelist is. There's no visual tool to find out (maybe there is in the new, Java based tool that is complete and utter ASS, but I refuse to use it). So you have to go to the command line. And it's pretty esoteric:
p4 changes -m1 #have<br />

Without the #have option, what you get it pretty much useless. And it's poorly documented that you need to have the #have option (#have isn't even documented, from what I can tell).


Groby said...

Oh, it's documented. 'p4 help revisions' for details. What you're really sending as command is 'p4 changes -m1 //...#have' - it's just that the initial wildcard is implicit

But keep in mind that this is not "the changelist" you have. It's the last changelist you synced to. No guarantees that resyncing to it will recreate the same environment, if you - for example - had partial syncs before.

If you need to tag *exactly* what's on your machine, use 'p4 tag'

Ash said...

I've actually not messed around with the 'tag' command. I'll do some digging on that.

For the majority of the cases, what we've been looking for is exactly what you've described, finding the changelist that you last sync'd to.