Sometimes a user will copy files using Windows Explorer and commit them when they should have performed an svn repository-level copy or a merge. Thus, SVN does not have proper tracking of these changes. Once I find out about this, the damage is clearly already done and there may have been a lot of subsequent edits to the files in question. It is important not to lose this part of the history as well. Is there anything I can do to retroactively improve things in the repository when I find out these situations have occurred?
Specifically, I have two scenarios, depending on whether the target file already existed or not. In the first sceanrio, (1) the user performed an add that did not record as a copy. In the second scenario, (2) the user performed an update that did not record as a merge.
Furthermore, both the source and the target file have undergone subsequent updates that have also been committed. Sometimes, these subsequent edits have also been made to both sides manually and thus without the proper mergeinfo.
POSSIBILITY: Might manually adding a mergeinfo revprop to the past revision help? If so, how do I do this? Please account for both scenarios.
Here are the scenarios I can think of and how to resolve them (if possible):
1) the files have been copied and modifications have been committed (to their original URL)
1a) if the branch does not have those files yet:
1b) if the branch does have those files already:
2) the files have been copied, modifications made but have not been committed (to their original URL as the copy did not change that)
Note: since the modifications have not been committed yet, there is no history to preserve, also nothing to do with the trunk
2a) if the branch does not have those files yet:
2b) if the branch does have those files already:
(*) use any regular merging tool for the job, e.g. WinMerge
Update: after your edit I understand your situation better (the above was with the assumption that after the manual copy the URL of the copied folder still pointed to the trunk)
You could try using svn propset --revprop -r <revision> snv:mergeinfo <updated mergeinfo>
(unless blocked by a pre-revprop-change hook) on the branch to "fix" the merge info, but I believe you will have to "fix" all subsequent revisions' mergeinfo as well since svn uses this information for fome of its operations (e.g. merges); also, because of the latter, you will have to be very careful about the updated contents.
A better option would be, I think, to just update the log at the revision of the incorrect-commit-to the-branch to include the revision of the trunk the copied files refer to. This way the information is available if needed but no risk of messing up svn's future operations. The big drawback of this approach is that merging the branch back to trunk might have some conflicts that will have to be resolved (as the merge info was not updated). The command to do this opetion is svn propset --revprop -r <revision> svn:log <updated log message>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With