Best way to migrate directories to SVN with history
I've weekly backups of source directories and want to migrate to SVN.
While moving to SVN I want to retain the evolution of the source directories to build up the SVN histories of the source tree.
Let me explain this through an example:my_project_2011_02_01.zip
my_project_2011_02_13.开发者_开发知识库zip
my_project_2011_02_18.zip
my_project_2011_02_23.zip
...
my task:
- extract the first version
my_project_2011_02_01.zip
and add this to SVN under my_project. - Now I want to extract
my_project_2011_02_13.zip
and add the new files, overwrite the changed files and remove the files that aren't in the source tree anymore.
I use the svn client tortoisesvn.
which way is the best / most comfortable way to achieve this?
You can write a batch script which basically does the following steps for each zip file:
- svn rm * (in project folder)
- extract zip and copy in project folder
- svn add --force . (in project folder)
- svn commit . -m "version of project snapshot" (in project folder)
I suspect the only way would be to start by checking in the first week's archive. Next, overwrite the local files with the second week's archive and check in those changes. Repeat until all archives are checked in.
The main annoyance with this, other than the amount of time it will take, is that svn will often be unable to auto-resolve conflicts. In your case, you would simply choose the latest version to win, but it will likely add more time to the process.
Is there any reason why you would need the full history? In this situation I would be inclined to only check in the latest version, and not worry about the history to this point. Or perhaps only check in archives related to major releases.
Edit: To handle deletes, you would need to delete the files on your hard drive first, then unzip the next archive. The annoying part is that you need to keep the .svn folders so svn can track which files are different and which were added or removed.
精彩评论