From bfdb6ac54b82e81358ed3e33b429563180c6cc08 Mon Sep 17 00:00:00 2001 From: Andras Date: Fri, 23 Jan 2015 15:02:02 -0500 Subject: [PATCH] --localtime option, to generate localtime git commit history timestamps (issues #128 and #130) --- lib/svn2git/migration.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 89d6828..a17b962 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -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 @@ -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 @@ -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.' @@ -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] @@ -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|