Search code examples
perforce-integrate

Perforce integrate files when target has been moved/renamed


How to integrate a branch back to trunk when files in the trunk have been moved or renamed while files in the branch have been changed?

The question Integrating moved files in perforce explains similar issue in reverse order, i.e. integrating trunk into branch where files have been moved. However, the answer does not help.

I am unable to use p4 integrate -3 in my scenario, and perforce always asks to specify -D or -Dt flag, which if specified, always creates new files instead of merging them into the existing moved files. Note that I am using latest Perforce client 2014.1.


Solution

  • If at all possible I'd recommend upgrading your server; I'm inferring from the fact that you're unable to use "p4 integrate -3" that you're on a fairly old release. With the latest server release the "integrate -3" functionality is enabled by default, without having to use an extra flag or anything, per this blog post:

    http://www.perforce.com/blog/130806/quality-life-improvements-renamed-files

    Having this functionality is a pretty big deal since it makes the scenario you describe "just work" -- all you have to do is integrate and resolve as normal.

    Without that functionality, you have to do some work -- either modify a branchspec to line the current versions of the files up and use that to integrate the content, or manually recreate the same rename operations in the branch so that the files line up normally.

    Note that this functionality requires a new server in addition to a new client, so a 2014.1 client on its own (with an old server) won't do the trick -- a server upgrade is necessary. If you're on an old release you'll need to do a restore from checkpoint as part of the upgrade, per the instructions in the administrator's guide:

    http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.install.html#d0e1167

    but I would recommend you don't let that deter you; you'll be getting a lot of improvements. :)