dacwe
dacwe

Reputation: 43504

perforce connect history of two different files

I have a problem, in a refactoring attempt I have copied files from one place to another and added them in my scm (perforce). When I was done and everything was working I deleted the old (moved) files.

Can I connect the file histories with each other? The best would be to se the "move" like it should have been done..

Thankful for any help!

Upvotes: 3

Views: 993

Answers (1)

Commodore Jaeger
Commodore Jaeger

Reputation: 33390

Suppose your original file is //source/old/file.c#5 and you moved it to //source/new/file.c, then deleted the old file in revision //source/old/file.c#6. You need to integrate from the old file to the new file, using the -i flag so Perforce will allow you to integrate between two files that it doesn't otherwise know of an integration history:

p4 integrate -i //source/old/file.c#5 //source/new/file.c

then resolve the files. Normally while integrating you'll want to accept a merged version of the file, but in this case you're mostly interested in letting Perforce know you already did the integration, so you can use -ay to "accept yours", discarding the old version of the file:

p4 resolve -ay //source/new/file.c

then submit the revision.

(Ideally you would have integrated first, then made any changes, and submitted everything, but this way the files will be linked in Perforce's integration history.)

Upvotes: 8

Related Questions