Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nirvdrum/svn2git
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Jan 25, 2011
2 parents a59cb83 + a02c141 commit 97e17ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -153,7 +153,7 @@ repository which name on its own line. This would allow you to easily
redirect the output of this command sequence to ~/.svn2git/authors and have
a very good starting point for your mapping.

$ svn log | grep -E "r[0-9]+ \| [a-z]+ \|" | awk '{print $3}' | sort | uniq
$ svn log | grep -E "r[0-9]+ \| [a-z0-9]+ \|" | awk '{print $3}' | sort | uniq

Debugging
---------
Expand Down
14 changes: 12 additions & 2 deletions lib/svn2git/migration.rb
Expand Up @@ -36,6 +36,7 @@ def parse(args)
# Set up reasonable defaults for options.
options = {}
options[:verbose] = false
options[:metadata] = false
options[:rootistrunk] = false
options[:trunk] = 'trunk'
options[:branches] = 'branches'
Expand Down Expand Up @@ -88,6 +89,10 @@ def parse(args)
options[:tags] = nil
end

opts.on('-m', '--metadata', 'Include metadata in git logs (git-svn-id)') do
options[:metadata] = true
end

opts.on('--authors AUTHORS_FILE', "Path to file containing svn-to-git authors mapping (default: #{DEFAULT_AUTHORS_FILE})") do |authors|
options[:authors] = authors
end
Expand Down Expand Up @@ -120,18 +125,23 @@ def clone!
trunk = @options[:trunk]
branches = @options[:branches]
tags = @options[:tags]
metadata = @options[:metadata]
rootistrunk = @options[:rootistrunk]
authors = @options[:authors]
exclude = @options[:exclude]

if rootistrunk
# Non-standard repository layout. The repository root is effectively 'trunk.'
run_command("git svn init --no-metadata --trunk=#{@url}")
cmd = "git svn init "
cmd += "--no-metadata " unless metadata
cmd += "--trunk=#{@url}"
run_command(cmd)

else
cmd = "git svn init --no-metadata "
cmd = "git svn init "

# Add each component to the command that was passed as an argument.
cmd += "--no-metadata " unless metadata
cmd += "--trunk=#{trunk} " unless trunk.nil?
cmd += "--tags=#{tags} " unless tags.nil?
cmd += "--branches=#{branches} " unless branches.nil?
Expand Down

0 comments on commit 97e17ff

Please sign in to comment.