Sometimes I find that I've got a file that has over time grown to contain more classes/functions/whatevers than I like. It's time to refactor! I usually find in this case that my one file becomes several: itself plus several other files, each containing distinct segments of the file.
Unfortunately, just creating these new files "breaks" history a bit -- it's hard to tell that those functions originally came from another file. It's even worse if there were any other changes made to the code during the refactoring.
One of my coworkers found that he could "abuse" the rename functionality by doing something like this:
hg rename --after original_file new_file_1
hg rename --after original_file new_file_2
hg rename --after original_file new_file_3
hg add original_file
The result is that each of the new files looks like a rename with the rest of the file removed, and the original file looks like it lost the removed blocks. So far, this seems ideal. However, I'm concerned that these multiple renames are going to cause some confused merges down the line.
Is there anything wrong with this "multiple renames" approach?