perforceperforce-integrate

Can't merge in Perforce


I have a branch that I created using p4 integrate but now the merge isn't behaving how I expect. When I merge, I get the following:

$ p4 merge -n ISSUE-49/... trunk/...
...
//depot/products/theProduct/trunk/some/directory/somefile.conf#1 - sync/delete from //depot/products/theProduct/ISSUE-49/some/directory/somefile.conf#1
...

That file was added on the ISSUE-49 branch (not deleted) so I don't understand why it wants to delete it.

When I try and use p4 integrate, I get:

$ p4 integrate -n ISSUE-49/... trunk/...
...
//depot/products/theProduct/trunk/some/directory/somefile.conf#1 - branch/sync from //depot/products/theProduct/ISSUE-49/some/directory/somefile.conf#1
...

It looks like it's trying to do a branch instead of a merge. Is it? How can I safely merge my changes from ISSUE-49 back into trunk?

I am trying to do this from the command-line on Linux using p4 2012.1. I have p4v 2013.3 on my Windows machine. I could use that if it would be easier.


Solution

  • A "merge" operation doesn't necessary always result in an "integrate" revision -- it depends on the current state of the target file and the changes made in the source file.

    A "branch" revision is the first revision of a new file that is created as a copy from some other file. A "delete" revision represents a file that does not actually exist (usually this is a placeholder for a file that previously existed and has been deleted, but it can also be a placeholder for a file that has never existed).

    The difference between "p4 merge" and "p4 integrate" is that with "p4 integrate" the file is opened for "branch" immediately rather than scheduling a resolve. If you run "p4 merge" followed by "p4 resolve -am" the file will be opened for "branch" exactly as if you'd run "p4 integrate".

    Summary: everything is fine. Since the file does not exist in the trunk yet, a normal merge from ISSUE-49 will create it in the trunk as a new file. Whether you run "p4 integrate"+"p4 resolve" or "p4 merge"+"p4 resolve", the file will be opened for "branch", which is the action that creates it as a new file that is identical to the ISSUE-49 file.