I have a file which has gotten too large, and should be refactored into two smaller files. What’s the best way to do this in Perforce such that the relationship to the original file is maintained?
I’m adding two new files, and deleting the original in this case, but I would expect there to be some general solution to this problem.
I think the simplest case would be to add one new file which contains a subset of the content of the original, and delete that content from the original file, but leave it in place (it’s trivial to delete it later anyway).
It would be nicest if the operation could be done in a single changelist to avoid any checkins which would break the build.
This can’t be done in a single checking, but it can certainly be done without “breaking the build”. Let’s say you want to split
bigFile.csintosmallFile1.csandsmallFile2.cs. First integrate the big file into the two little files and submit them.You now have two extra files in your project directory, but they’re doing no harm. Now check out
smallFile1.csandsmallFile2.cs, and your project file(s). Add references to the smaller files, remove the reference to the big, edit the small files accordingly, etc. Finally, markbigFile.csfor delete and submit your changes.You have now split your big file into two smaller files and the smaller files’ history will show you their big file origins.