A Little Productivity Boost: Status Command and Ignore Files

Feb 23, 2012

I bought a new car a couple of months ago, and it has a cold box for drinks. It definitely wasn’t on our list of features to look for, because we didn’t even realize what it was until we brought the new car home. I wondered if I’d ever really use it, until one day I stuck a soda in there just to try it out, and got to enjoy a cold drink after a long drive through the foothills of the Rockies. Now I’m pretty sure I’ll be looking for a cold box in any new car I buy. Sure, I could always pack a cooler in the car… but having a built-in cold box is just so much better.

That’s the same feeling I get when I use a few of the new features in the 2012.1 release. At long last, Perforce now supports a status command (although we call it reconcile) and ignore files. Plus, you can now create a new branch or stream as a purely server-side operation.

Status Command: What's Changed in the Workspace

The p4 reconcile command will be very familiar to anyone who’s used status commands before. It detects files that you’ve edited, added, or deleted without telling Perforce in advance what you’re up to. That’s a big time saver if you’re working offline or your IDE tends to generate new files automatically. Here’s what it looks like with one new file that needs to be added:

    > p4 reconcile -n …
    //depot/Jam/MAIN/src/foo.bar#1 – opened for add

Ignore File: Ignoring Files in the Workspace

The ignore file lets you tell Perforce to completely disregard some files in your workspace, like any intermediate build cruft. You can check in an ignore file to share it with other users, making it really easy to configure a project properly for a whole team. You could do the same thing with stream views, but regular workspace views aren’t as easy to configure centrally.

Here’s how I set it up. I specify the name of my ignore file in my P4CONFIG file:

    P4IGNORE=ignore.txt

Then I drop a file called ignore.txt in whatever level of the workspace makes sense. Here I’ll make one for the main branch of my Jam project:

    > cat .\ignore.txt
    *.obj

Any .obj files will be ignored when I run p4 reconcile in that branch, and it’ll prevent me from accidentally adding those files manually.

Populate Command: Easy Branch Creation

And finally, the p4 populate command is your one-stop shop for making new branches or streams quickly without any interaction with a workspace. So, to make a new dev branch for a project, I can just run:

    > p4 populate -d “new jam branch” //depot/Jam/MAIN/… //depot/Jam/DEV2.4/…
    72 files branched (change 12079).

Nice and simple! No need to modify a workspace view or get a copy of the files in my workspace. And, the new branch submits in a single step. The syntax of p4 populate is very similar to what you’d use with p4 integp4 merge, or p4 copy.

Are these new features critical to making SCM work right? Not really. Are there workarounds? Sure. But the drive is a lot better now.  Grab the 2012.1 beta release and try it for yourself.

perforce's picture
About the author:

Perforce’s version management technology increases productivity, improves software quality, and helps reduce the complexity of global environments. Our solutions scale up to meet the needs of the most demanding environments, yet remain simple and intuitive for individuals to use for their personal projects.

See all posts by