Associate renamed file with "deleted" file in previous commit

1

This has probably already been asked, and I certainly would appreciate if someone finds a proper duplicate. However, please make sure to read the question carefully before marking it as duplicate.

A while ago, I accidentally renamed a set of file without properly renaming the files in TortoiseSVN. Instead of associating the deleted files with their renames, I did a commit that simply deleted the files and added others. Now I would like to fix the association between the two files so the previous history shows up in the log for that file. I have a certain idea that a revert may help, but I am admittedly somewhat ignorant of how reverts work in TortoiseSVN, and they may not actually be the solution.

To clarify, I want to:

  • Rename the files so that the Tortoise SVN log includes their previous history
    • I am aware this might be a multi-step process, and my general understanding is that the process would be something like the following:
      1. Revert the changes
      2. Rename the files the right way
      3. Get back the changes in the commit since the original
        • Using this particular process, I am unsure how to properly handle step 3; ideally, each of my old individual commits would be accreted in the same way to the same files, but I don't know how to do that. Or perhaps I am misguided, and I really should just take the content of the latest commit and add it as the next commit to those files.

Note I have already referenced the following links, and while helpful, did not provide a direct answer to my question:

Graham

Posted 2018-11-18T14:54:38.950

Reputation: 194

I'm not sure what your actual question is about: How to do what you want, reverts or if it's possible at all? Because your subject is simply not possible, the way to go is to revert your two changes and instead of deleting rename the files. But you already mentioned that yourself in the end. – Thorsten Schöning – 2018-11-18T15:25:12.513

1@ThorstenSchöning Sorry for the lack of clarity. I've edited my question. I'm trying to avoid asking an XY-question. – Graham – 2018-11-18T16:23:04.300

Answers

0

Regarding your step 3, I think you can do both of what you mentioned. Getting individual commits back needs a branch, though: Branch your current trunk, revert before deleting/adding, do+commit proper renaming, merge+commit each commit of interest of trunk to your branch, merge branch to your trunk. This will result in one commit only in trunk including all changes, but SVN will be able to distinguish your former individual commits during blame etc.

You can do the same on trunk with simply overwriting the files of interest after proper renaming with the contents they had before you were reverting. Either with all changes individually or only the latest status of the file, that depends on what you like. Keep in mind that SVN will always have your former individual commits in the history of the parent directory, so it might be unnecessary to get each of that back for your concrete files of interest.

In the end, you can easily try all of those approaches by simply creating branches of your current trunk and have a look at how logs look like for individual files, their parent dirs etc. before/after applying changes. You might not even care about proper renaming anymore now in favour of keeping the individual commits you have for only the new files. In the end, you renamed them for a reason, so how likely is it you care about the old status at all in the future?

To make things more complicated, you could even dump the current repo to only that revision before you deleted/added and use that as a new base with proper renaming and applying of individual changes to commit again. That way you wouldn't have any old commit messages anymore at all and a very clean history. Don't think it's worth it, though.

Thorsten Schöning

Posted 2018-11-18T14:54:38.950

Reputation: 523