June 20, 2011

Ignoring Branches (and Deletes)

Integration
Healthcare
Integration

2011.1 is going to have a lot of exciting new integrate/resolve functionality, and so far I've blogged about how we're going to be able to resolve moves and filetypes. When you read the 2011.1 release notes, you may notice a two-digit job number in there and wonder if it's a typo. It's not, and that long-awaited functionality is the subject of today's blog post.

Long ago and in a land far away, Steph Turner and I gave a talk on a bunch of ways that you can get the dreaded "can't integrate without" error messages from 'p4 integrate'. Most of the examples dealt with the '-d' flag, and the big idea that I wanted users to take away from that talk was that just slapping the '-d' flag on every 'p4 integrate' command wasn't a good general policy, any more than running 'p4 resolve -at' every time you have a conflict. In essence, any time you get a "can't integrate without -d" warning you're being told that there's a conflict between an edit and a delete; either you're trying to integrate a deleted file into one that has been edited, or you're trying to merge an edit into a file that has been deleted. Unfortunately, the mechanism of issuing a warning and refusing the integrate wasn't nearly as user-friendly as our normal conflict resolution system. To 'accept' the action and overwrite the target you needed to re-run the integrate with the flag, and to 'ignore' it you had to exclude the file(s) from your branch spec.

As of 2011.1, the edit/delete conflict situations that previously produced a "can't integrate" warning will now open the file and schedule a resolve. For example, if you are trying to merge an edit into a deleted file, the file will be opened for 'delete' and a resolve will be scheduled that looks like this:

Branch resolve:
at: branch
ay: ignore
Accept(at/ay) Skip(s) Help(?) s:

If you 'accept theirs', the file will be reopened for branch (overwriting the deleted target with the edited source in its entirety). If you 'accept yours', the file is left open for delete, and submitting it will record an 'ignored' credit that will mark the source revision(s) as having been integrated.

As with the '-t' flag I discussed in my last post, the '-d' flag is still around for backward compatibility, but using it will also disable this new functionality by effectively doing a 'resolve -at' everyplace that you would have normally had to perform a branch/delete resolve.

Note that when there's no conflict, 'p4 integrate' is going to go ahead and open the file for branch or delete as usual by default; we didn't want to add overhead to the process of creating a branch by making you run an extra step to resolve a bunch of files. If you do want to schedule a resolve in a case where there's no conflict, though (say, because you added a file to your release branch that you want 'ignored' in the mainline), there are new flags on integrate (-Rb and -Rd) that will force all 'branch' and/or 'delete' actions to go through a resolve step.

That concludes this three-part series on 2011.1's new integrate/resolve functionality. I had intended to be on hand at the User's Conference last week to answer questions, but since I was sent home by the plague, feel free to post those questions on our forums and I'll see if I can fill in the gaps.