docs:git:converting_an_svn_project_to_git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
docs:git:converting_an_svn_project_to_git [2010/09/20 10:29] – created billhdocs:git:converting_an_svn_project_to_git [2013/10/13 11:31] (current) – [set up svn to git user mappings] billh
Line 3: Line 3:
  
 ===== set up svn to git user mappings ===== ===== set up svn to git user mappings =====
-  - create a text file somewhere (~/Desktop/users.txt) to map the svn users to git users<code>+  - create a text file somewhere (~/.git-svn-users) to map the svn users to git users<code>
 jdoe = John Doe <jdoe@example.com> jdoe = John Doe <jdoe@example.com>
 </code> </code>
   - alter your global config file (~/.gitconfig) to use this user mappings file<code>   - alter your global config file (~/.gitconfig) to use this user mappings file<code>
-git config --global svn.authorsfile ~/Desktop/users.txt+git config --global svn.authorsfile ~/.git-svn-users
 </code> </code>
  
Line 13: Line 13:
   - use git svn to clone your svn project to a temporary directory<code>   - use git svn to clone your svn project to a temporary directory<code>
 git svn clone svn://repo/path/to/myproject myproject_tmp --no-metadata git svn clone svn://repo/path/to/myproject myproject_tmp --no-metadata
 +</code>
 +    * UPDATE - it seems as if the error below could be related to Tortoise and/or the TortoiseSVN cache running at the same time (we are writing these conversions directly into an svn working copy)
 +    * if you get an error like the following, just ctrl-c the operation, delete the temporary directory, and try it again<code>
 +20592274 [main] perl 3584 C:\cygwin\bin\perl.exe: *** fatal error - unable to remap C:\cygwin\bin\cygserf-0-0.dll to same address as parent: 0xA80000 != 0x1390000
 +20597997 [main] perl 3572 fork: child 3584 - died waiting for dll loading, errno 11
 </code> </code>
   - cd into myproject_tmp, and either run gitk or git log to review the author names and emails, to make sure your svn user mappings worked; then cd back up one directory   - cd into myproject_tmp, and either run gitk or git log to review the author names and emails, to make sure your svn user mappings worked; then cd back up one directory
Line 25: Line 30:
 </code> </code>
   - (optional) compare your current svn working copy with the final git working copy, then remove the project from svn   - (optional) compare your current svn working copy with the final git working copy, then remove the project from svn
 +
 +If you are lucky (no errors), steps 1-5 can be automated with a simple bash loop:<code bash>
 +for file in {project1,project2,project3}
 +do
 +        git svn clone file:///path/to/svn/repo/project/${file} ${file}_tmp --no-metadata \
 +        && git clone --bare ${file}_tmp /path/to/git/shares/${file}.git \
 +        && rm -Rf ${file}_tmp/ \
 +        && git clone /path/to/git/shares/${file}.git/
 +done
 +</code>
  
 ===== old method ===== ===== old method =====
Line 65: Line 80:
 </code> </code>
   - you should also consider that although svn allows empty directories as part of the repo, git does not; we usually fix this by adding empty files named .emptydir in any directory that needs it   - you should also consider that although svn allows empty directories as part of the repo, git does not; we usually fix this by adding empty files named .emptydir in any directory that needs it
 +
 +===== See Also =====
 +  * [[importing an svn repository]]
 +
  • docs/git/converting_an_svn_project_to_git.1285000181.txt.gz
  • Last modified: 2010/09/20 10:29
  • by billh