Salutations,
I've got a binary file (specifically an Unreal asset) that I'm trying to replace with a new version of that binary file in a Perforce changelist. The new file is generated (via a processor in Unreal) in a different folder and I'm trying to do a move-replace to overwrite the old version of the file in a different folder.
I can't move the new binary file into the same folder as the old binary file because it already exists, and marking it for delete doesn't help because it still "exists" until the delete is committed.
I expected there to be some option to overwrite the one with the other within a single changelist, preferably with the file history intact. Is there something I can do to get this result?
SOLUTION: Open the target file for edit in Perforce, then drag-and-drop the source file into the directory of the target file in the File Explorer. Select the option to replace the file, and voila! Perforce will consider that an edit, instead of a deletion.
It's important to be clear on whether you're replacing the existing depot file with another existing (possibly locally modified) depot file or with an existing local file that has not yet been added to the depot.
I'll assume that this is a local file, which makes it simple. What you most likely want to do is open the existing depot file for edit (using p4 edit
or P4V's equivalent "Check Out" command), and then overwrite the corresponding local file (which is now writable) with your other local file. Now you can submit
the modified file.
The edit
revision that's recorded after you do this will not have any special metadata to indicate that it originated from a different path. If this is a file that only ever existed locally, that's probably fine! A file that was never added to the depot might as well have never existed as far as Perforce is concerned.
If the other file was added to the depot, then what you probably want to do is a two-step process of deleting the existing file, submitting, and then moving the other file into its place; that will give you the moved from
revision that records the original depot path as part of the history of the file in its new path.