Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--localtime option, to generate localtime git commit history timestamps ... #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/svn2git/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def parse(args)
options[:revision] = nil
options[:username] = nil
options[:rebasebranch] = false
options[:localtime] = nil

if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
options[:authors] = DEFAULT_AUTHORS_FILE
Expand Down Expand Up @@ -125,6 +126,10 @@ def parse(args)
options[:exclude] << regex
end

opts.on('--localtime', 'Use localtime for git commit history timestamps (default is GMT)') do
options[:localtime] = true
end

opts.on('-v', '--verbose', 'Be verbose in logging -- useful for debugging issues') do
options[:verbose] = true
end
Expand Down Expand Up @@ -172,6 +177,7 @@ def clone!
exclude = @options[:exclude]
revision = @options[:revision]
username = @options[:username]
@localtime = @options[:localtime]

if rootistrunk
# Non-standard repository layout. The repository root is effectively 'trunk.'
Expand Down Expand Up @@ -205,6 +211,7 @@ def clone!
run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil?

cmd = "git svn fetch "
cmd += "--localtime " if @localtime
unless revision.nil?
range = revision.split(":")
range[1] = "HEAD" unless range[1]
Expand Down Expand Up @@ -308,7 +315,9 @@ def fix_branches
svn_branches.delete_if { |b| b.strip !~ %r{^svn\/} }

if @options[:rebase]
run_command("git svn fetch", true, true)
cmd = "git svn fetch"
cmd += " --localtime" if @localtime
run_command(cmd, true, true)
end

svn_branches.each do |branch|
Expand Down