I have to remove a branch from svn history for good. Normally I would use
svnadmin dump /path/to/repo |svndumpfilter --drop-empty-revs --renumber-revs exclude /branches/bad_branch
However this branch was not just created, but also moved and then removed and dump script fails to process downstream开发者_JS百科 information with messages like: Invalid copy source path '/branches/bad_branch'
So I imagine 2 ways to cope with the problem
keep only last few revisions of the history and put current repository as an archive on the web
make a dump up to the revision where the 'bad_branch' was created and apply the rest of the changes as a patch, therefore losing history of a few recent commits.
Is there a better, cleaner way to deal with this?
The first part of your number 2 will work. So yes, create a dump up to where the offending branch was introduced and create a new repository with it. Then still using svnadmin dump and the --incremental option, dump all the good revisions between the bad branch revisions. Here's an example of what the incremental dump command would look like:
svnadmin dump /path/to/repo --incremental -r 1234:2345
Keep applying these incremental dumps to the new repository. This should produce a repository without the offending bad branch creation, moves, and commits and preserve all your history for those good revisions that a patch, as you suggested, would destroy.
Depending on how many revisions the bad branch has, this is a lot of work. It is also the only way to do this with 1.6.x versions or earlier of Subversion at this time.
Now here's the caveat. If there are commit messages in the good revisions that have reference to revision numbers, they will be off. This won't be to bad if there are a limited few of them, but could be tedious to correct if there are many.
精彩评论