Created
February 28, 2012 12:35
-
-
Save jponge/1932284 to your computer and use it in GitHub Desktop.
How I recovered a SVN repo archive, extracted mod/{trunk,tags,branches} submodules, and merged it into a single Git repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # export/ is a svn checkout | |
| modules = Dir['export/*'].map { |path| path[7..-1]} | |
| modules.each do |mod| | |
| puts "\n>>> Converting #{mod}\n\n" | |
| system "git svn clone --no-metadata --preserve-empty-dirs --stdlayout --authors-file=users.txt svn://localhost/#{mod} git/#{mod}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'FileUtils' | |
| include FileUtils | |
| wipe = %w{ | |
| MERGED | |
| au.unsw.singh.wsoperations | |
| OperationsLibrary | |
| fr.isima.ponge.wsprotocol.wsoperations | |
| fr.isima.rivetgarcia.bpel2protocol | |
| ProtocolEmptiness | |
| fr.isima.lebeausempe.wsprotocol.emptiness | |
| fr.isima.lebeausempe.wsprotocol.emptiness.ui | |
| } | |
| wipe.each { |repo| rm_rf repo } | |
| repos = Dir['*'] | |
| mkdir "MERGED" | |
| chdir "MERGED" | |
| system "git init" | |
| touch ".gitignore" | |
| system "git add .gitignore" | |
| system "git commit -am '.gitignore file'" | |
| repos.each do |repo| | |
| puts ">>> Merging on #{repo}" | |
| system "git remote add -f #{repo} ../#{repo}" | |
| system "git merge -s ours --no-commit #{repo}/master" | |
| system "git read-tree --prefix=#{repo}/ -u #{repo}/master" | |
| system "git commit -m \"Subtree merged in #{repo}\"" | |
| end | |
| chdir ".." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| authors=$(svn log svn://localhost | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq) | |
| for author in ${authors}; do | |
| echo "${author} = NAME <USER@DOMAIN>"; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment