Skip to content

Commit bfdb6ac

Browse files
author
Andras
committed
--localtime option, to generate localtime git commit history timestamps (issues nirvdrum#128 and nirvdrum#130)
1 parent 21ace8b commit bfdb6ac

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/svn2git/migration.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def parse(args)
5353
options[:revision] = nil
5454
options[:username] = nil
5555
options[:rebasebranch] = false
56+
options[:localtime] = nil
5657

5758
if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
5859
options[:authors] = DEFAULT_AUTHORS_FILE
@@ -125,6 +126,10 @@ def parse(args)
125126
options[:exclude] << regex
126127
end
127128

129+
opts.on('--localtime', 'Use localtime for git commit history timestamps (default is GMT)') do
130+
options[:localtime] = true
131+
end
132+
128133
opts.on('-v', '--verbose', 'Be verbose in logging -- useful for debugging issues') do
129134
options[:verbose] = true
130135
end
@@ -172,6 +177,7 @@ def clone!
172177
exclude = @options[:exclude]
173178
revision = @options[:revision]
174179
username = @options[:username]
180+
@localtime = @options[:localtime]
175181

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

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

310317
if @options[:rebase]
311-
run_command("git svn fetch", true, true)
318+
cmd = "git svn fetch"
319+
cmd += " --localtime" if @localtime
320+
run_command(cmd, true, true)
312321
end
313322

314323
svn_branches.each do |branch|

0 commit comments

Comments
 (0)