Skip to content

Commit

Permalink
--localtime option, to generate localtime git commit history timestam…
Browse files Browse the repository at this point in the history
…ps (issues nirvdrum#128 and nirvdrum#130)
  • Loading branch information
Andras committed Jan 23, 2015
1 parent 21ace8b commit bfdb6ac
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit bfdb6ac

Please sign in to comment.