I need to combine the functionality of two classes into one, but I am wondering can I combine their change history as well?
Both classes contains lots of previous changes, so I want to keep their change history in one place for reference. I can make a comment in the combined class, but in an IDE, it’s not very easy to get the history of a deleted file.
To do this, you need to record the file merging as a merge changeset.
Say changeset 0 is your current head with files A and B which you want to merge into file C. To do this, rename your file A to C and commit as changeset 1, then update back to changeset 0, rename file B to C and commit this as changeset 2. Next, you merge these two changesets, combining their content and removing the remaining files A and B. This causes the file history of C to be registered as descending from both A and B. Finally you can rename file C back to A.
The resulting tree looks as follows:
Example command line flow:
And if you now type
hg log -f ayou will notice that the history of both files is shown.