svn2git 2.2.2 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog.markdown +16 -1
- data/README.markdown +35 -6
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/bin/svn2git +1 -0
- data/lib/svn2git/migration.rb +80 -24
- data/svn2git.gemspec +5 -13
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 14294b9fe3b9c678bde246f6312efa2e32721bdb
|
4
|
+
data.tar.gz: 72b0efbcca461dc3e9f73bb2c60d87e627b1cff8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55d42fb0ac0c9d0da5d98dfac0554ac30151eb418e2a1303a014c3b6278c7bfc1f81444d4116247204233fe0e2751260d30aa83cee995b31070bdd868f4a9ead
|
7
|
+
data.tar.gz: 5dae5756b74582e831bd9eed0e8dc85348b99afc16ced0a4dcd776a11afbe537e2c2a766d89a73cb8815ea7af2c0f984133831407ecb9fc95eaf4dbda04d1800
|
data/ChangeLog.markdown
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
# 2.2.
|
1
|
+
# 2.2.4 - 2014-04-08
|
2
|
+
|
3
|
+
There was a permissions problem with some of the files packed in 2.2.3. This was caught immediately after the gem
|
4
|
+
was pushed, so it was yanked as it simply wouldn't work for anyone. 2.2.4 contains everything 2.2.3 did, but with
|
5
|
+
proper packaging.
|
6
|
+
|
7
|
+
# 2.2.3 - 2014-04-08
|
8
|
+
|
9
|
+
This is a bugfix release. First change done by FeeJai
|
10
|
+
|
11
|
+
* Fixed an issue with password protected svn-repositories. The prompt to enter the password is now displayed.
|
12
|
+
* Fixed an issue with server certificates. If the certificate is untrusted, the prompt to confirm or deny the certificate is now shown.
|
13
|
+
* Fixed an issue with using the `--local` flag for `git config` in git versions < 1.7.4.
|
14
|
+
|
15
|
+
|
16
|
+
# 2.2.2 - 2012-10-07
|
2
17
|
|
3
18
|
This is an overdue bugfix release. No new features were added, but several long-standing bugs fixed by the community
|
4
19
|
have been merged. Many thanks to Edson de Lima (edsonlima), Rudger (Rud5G), Ben Wolfe (bwolfe), CyberTech, PowerKiKi, and Philipp Riemer (ruderphilipp) for the pull requests.
|
data/README.markdown
CHANGED
@@ -64,13 +64,11 @@ the svn repo.
|
|
64
64
|
Installation
|
65
65
|
------------
|
66
66
|
|
67
|
-
Make sure you have git, git-svn, and ruby installed. svn2git is a ruby wrapper around git's native SVN support through git-svn. It is possible to have git
|
68
|
-
installed without git-svn installed, so please do verify that you can run `$ git svn` successfully. For a Debian-based system, the installation of the
|
69
|
-
prerequisites would like like:
|
67
|
+
Make sure you have git, git-svn, and ruby installed. svn2git is a ruby wrapper around git's native SVN support through git-svn. It is possible to have git installed without git-svn installed, so please do verify that you can run `$ git svn` successfully. For a Debian-based system, the installation of the prerequisites would look like:
|
70
68
|
|
71
69
|
$ sudo apt-get install git-core git-svn ruby rubygems
|
72
70
|
|
73
|
-
Once you have the necessary software your system, you can install svn2git through rubygems, which will add the `svn2git` command to your PATH.
|
71
|
+
Once you have the necessary software on your system, you can install svn2git through rubygems, which will add the `svn2git` command to your PATH.
|
74
72
|
|
75
73
|
$ sudo gem install svn2git
|
76
74
|
|
@@ -128,6 +126,10 @@ one of them.
|
|
128
126
|
|
129
127
|
$ svn2git http://svn.example.com/path/to/repo --revision <<starting_revision_number>>:<<ending_revision_number>>
|
130
128
|
|
129
|
+
10. Include metadata (git-svn-id) in git logs.
|
130
|
+
|
131
|
+
$ svn2git http://svn.example.com/path/to/repo --metadata
|
132
|
+
|
131
133
|
The above will create a git repository in the current directory with the git
|
132
134
|
version of the svn repository. Hence, you need to make a directory that you
|
133
135
|
want your new git repo to exist in, change into it and then run one of the
|
@@ -174,11 +176,11 @@ repository which name on its own line. This would allow you to easily
|
|
174
176
|
redirect the output of this command sequence to `~/.svn2git/authors` and have
|
175
177
|
a very good starting point for your mapping.
|
176
178
|
|
177
|
-
$ svn log --quiet | grep -E "r[0-9]+ \| .+ \|" |
|
179
|
+
$ svn log --quiet | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/^ //' | sort | uniq
|
178
180
|
|
179
181
|
Or, for a remote URL:
|
180
182
|
|
181
|
-
$ svn log --quiet http://path/to/root/of/project | grep -E "r[0-9]+ \| .+ \|" |
|
183
|
+
$ svn log --quiet http://path/to/root/of/project | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/^ //' | sort | uniq
|
182
184
|
|
183
185
|
Debugging
|
184
186
|
---------
|
@@ -191,6 +193,32 @@ You can turn on verbose logging with the `-v` or `--verbose` flags, like so:
|
|
191
193
|
|
192
194
|
$ svn2git http://svn.yoursite.com/path/to/repo --verbose
|
193
195
|
|
196
|
+
Options Reference
|
197
|
+
-----------------
|
198
|
+
|
199
|
+
$ svn2git --help
|
200
|
+
Usage: svn2git SVN_URL [options]
|
201
|
+
|
202
|
+
Specific options:
|
203
|
+
--rebase Instead of cloning a new project, rebase an existing one against SVN
|
204
|
+
--username NAME Username for transports that needs it (http(s), svn)
|
205
|
+
--trunk TRUNK_PATH Subpath to trunk from repository URL (default: trunk)
|
206
|
+
--branches BRANCHES_PATH Subpath to branches from repository URL (default: branches)
|
207
|
+
--tags TAGS_PATH Subpath to tags from repository URL (default: tags)
|
208
|
+
--rootistrunk Use this if the root level of the repo is equivalent to the trunk and there are no tags or branches
|
209
|
+
--notrunk Do not import anything from trunk
|
210
|
+
--nobranches Do not try to import any branches
|
211
|
+
--notags Do not try to import any tags
|
212
|
+
--no-minimize-url Accept URLs as-is without attempting to connect to a higher level directory
|
213
|
+
--revision START_REV[:END_REV]
|
214
|
+
Start importing from SVN revision START_REV; optionally end at END_REV
|
215
|
+
-m, --metadata Include metadata in git logs (git-svn-id)
|
216
|
+
--authors AUTHORS_FILE Path to file containing svn-to-git authors mapping (default: ~/.svn2git/authors)
|
217
|
+
--exclude REGEX Specify a Perl regular expression to filter paths when fetching; can be used multiple times
|
218
|
+
-v, --verbose Be verbose in logging -- useful for debugging issues
|
219
|
+
|
220
|
+
-h, --help Show this message
|
221
|
+
|
194
222
|
FAQ
|
195
223
|
---
|
196
224
|
|
@@ -220,3 +248,4 @@ FAQ
|
|
220
248
|
that very same tag in the original svn repo. This is only due to the fact
|
221
249
|
that the svn tags allow changesets in them, making them not just annotated
|
222
250
|
tags.
|
251
|
+
|
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
data/bin/svn2git
CHANGED
data/lib/svn2git/migration.rb
CHANGED
@@ -13,6 +13,9 @@ module Svn2Git
|
|
13
13
|
if @options[:rebase]
|
14
14
|
show_help_message('Too many arguments') if args.size > 0
|
15
15
|
verify_working_tree_is_clean
|
16
|
+
elsif @options[:rebasebranch]
|
17
|
+
show_help_message('Too many arguments') if args.size > 0
|
18
|
+
verify_working_tree_is_clean
|
16
19
|
else
|
17
20
|
show_help_message('Missing SVN_URL parameter') if args.empty?
|
18
21
|
show_help_message('Too many arguments') if args.size > 1
|
@@ -23,6 +26,8 @@ module Svn2Git
|
|
23
26
|
def run!
|
24
27
|
if @options[:rebase]
|
25
28
|
get_branches
|
29
|
+
elsif @options[:rebasebranch]
|
30
|
+
get_rebasebranch
|
26
31
|
else
|
27
32
|
clone!
|
28
33
|
end
|
@@ -45,6 +50,7 @@ module Svn2Git
|
|
45
50
|
options[:exclude] = []
|
46
51
|
options[:revision] = nil
|
47
52
|
options[:username] = nil
|
53
|
+
options[:rebasebranch] = false
|
48
54
|
|
49
55
|
if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
|
50
56
|
options[:authors] = DEFAULT_AUTHORS_FILE
|
@@ -121,6 +127,10 @@ module Svn2Git
|
|
121
127
|
options[:verbose] = true
|
122
128
|
end
|
123
129
|
|
130
|
+
opts.on('--rebasebranch REBASEBRANCH', 'Rebase specified branch.') do |rebasebranch|
|
131
|
+
options[:rebasebranch] = rebasebranch
|
132
|
+
end
|
133
|
+
|
124
134
|
opts.separator ""
|
125
135
|
|
126
136
|
# No argument, shows at tail. This will print an options summary.
|
@@ -158,7 +168,7 @@ module Svn2Git
|
|
158
168
|
cmd += "--no-minimize-url "
|
159
169
|
end
|
160
170
|
cmd += "--trunk=#{@url}"
|
161
|
-
run_command(cmd)
|
171
|
+
run_command(cmd, true, true)
|
162
172
|
|
163
173
|
else
|
164
174
|
cmd = "git svn init --prefix=svn/ "
|
@@ -175,10 +185,10 @@ module Svn2Git
|
|
175
185
|
|
176
186
|
cmd += @url
|
177
187
|
|
178
|
-
run_command(cmd)
|
188
|
+
run_command(cmd, true, true)
|
179
189
|
end
|
180
190
|
|
181
|
-
run_command("
|
191
|
+
run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil?
|
182
192
|
|
183
193
|
cmd = "git svn fetch "
|
184
194
|
unless revision.nil?
|
@@ -198,7 +208,7 @@ module Svn2Git
|
|
198
208
|
regex = '^(?:' + regex.join('|') + ')(?:' + exclude.join('|') + ')'
|
199
209
|
cmd += "'--ignore-paths=#{regex}'"
|
200
210
|
end
|
201
|
-
run_command(cmd)
|
211
|
+
run_command(cmd, true, true)
|
202
212
|
|
203
213
|
get_branches
|
204
214
|
end
|
@@ -211,12 +221,40 @@ module Svn2Git
|
|
211
221
|
|
212
222
|
# Tags are remote branches that start with "tags/".
|
213
223
|
@tags = @remote.find_all { |b| b.strip =~ %r{^svn\/tags\/} }
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
def get_rebasebranch
|
228
|
+
get_branches
|
229
|
+
@local = @local.find_all{|l| l == @options[:rebasebranch]}
|
230
|
+
@remote = @remote.find_all{|r| r.include? @options[:rebasebranch]}
|
231
|
+
|
232
|
+
if @local.count > 1
|
233
|
+
pp "To many matching branches found (#{@local})."
|
234
|
+
exit 1
|
235
|
+
elsif @local.count == 0
|
236
|
+
pp "No local branch named \"#{@options[:rebasebranch]}\" found."
|
237
|
+
exit 1
|
238
|
+
end
|
239
|
+
|
240
|
+
if @remote.count > 2 # 1 if remote is not pushed, 2 if its pushed to remote
|
241
|
+
pp "To many matching remotes found (#{@remotes})"
|
242
|
+
exit 1
|
243
|
+
elsif @remote.count == 0
|
244
|
+
pp "No remote branch named \"#{@options[:rebasebranch]}\" found."
|
245
|
+
exit 1
|
246
|
+
end
|
247
|
+
pp "Local branches \"#{@local}\" found"
|
248
|
+
pp "Remote branches \"#{@remote}\" found"
|
249
|
+
|
250
|
+
@tags = [] # We only rebase the specified branch
|
251
|
+
|
214
252
|
end
|
215
253
|
|
216
254
|
def fix_tags
|
217
255
|
current = {}
|
218
|
-
current['user.name'] = run_command("
|
219
|
-
current['user.email'] = run_command("
|
256
|
+
current['user.name'] = run_command("#{git_config_command} --get user.name", false)
|
257
|
+
current['user.email'] = run_command("#{git_config_command} --get user.email", false)
|
220
258
|
|
221
259
|
@tags.each do |tag|
|
222
260
|
tag = tag.strip
|
@@ -225,17 +263,14 @@ module Svn2Git
|
|
225
263
|
date = run_command("git log -1 --pretty=format:'%ci' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse
|
226
264
|
author = run_command("git log -1 --pretty=format:'%an' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse
|
227
265
|
email = run_command("git log -1 --pretty=format:'%ae' \"#{escape_quotes(tag)}\"").chomp("'").reverse.chomp("'").reverse
|
228
|
-
run_command("
|
229
|
-
run_command("
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
ENV['GIT_COMMITTER_DATE'] = original_git_committer_date
|
237
|
-
end
|
238
|
-
|
266
|
+
run_command("#{git_config_command} user.name \"#{escape_quotes(author)}\"")
|
267
|
+
run_command("#{git_config_command} user.email \"#{escape_quotes(email)}\"")
|
268
|
+
|
269
|
+
original_git_committer_date = ENV['GIT_COMMITTER_DATE']
|
270
|
+
ENV['GIT_COMMITTER_DATE'] = escape_quotes(date)
|
271
|
+
run_command("git tag -a -m \"#{escape_quotes(subject)}\" \"#{escape_quotes(id)}\" \"#{escape_quotes(tag)}\"")
|
272
|
+
ENV['GIT_COMMITTER_DATE'] = original_git_committer_date
|
273
|
+
|
239
274
|
run_command("git branch -d -r \"#{escape_quotes(tag)}\"")
|
240
275
|
end
|
241
276
|
|
@@ -246,9 +281,9 @@ module Svn2Git
|
|
246
281
|
# If a line was read, then there was a config value so restore it.
|
247
282
|
# Otherwise unset the value because originally there was none.
|
248
283
|
if value.strip != ''
|
249
|
-
run_command("
|
284
|
+
run_command("#{git_config_command} #{name} \"#{value.strip}\"")
|
250
285
|
else
|
251
|
-
run_command("
|
286
|
+
run_command("#{git_config_command} --unset #{name}")
|
252
287
|
end
|
253
288
|
end
|
254
289
|
end
|
@@ -259,7 +294,7 @@ module Svn2Git
|
|
259
294
|
svn_branches.delete_if { |b| b.strip !~ %r{^svn\/} }
|
260
295
|
|
261
296
|
if @options[:rebase]
|
262
|
-
run_command("git svn fetch")
|
297
|
+
run_command("git svn fetch", true, true)
|
263
298
|
end
|
264
299
|
|
265
300
|
svn_branches.each do |branch|
|
@@ -293,16 +328,23 @@ module Svn2Git
|
|
293
328
|
run_command("git gc")
|
294
329
|
end
|
295
330
|
|
296
|
-
def run_command(cmd, exit_on_error=true)
|
331
|
+
def run_command(cmd, exit_on_error=true, printout_output=false)
|
297
332
|
log "Running command: #{cmd}"
|
298
333
|
|
299
334
|
ret = ''
|
300
335
|
|
301
336
|
cmd = "2>&1 #{cmd}"
|
302
337
|
IO.popen(cmd) do |stdout|
|
303
|
-
|
304
|
-
|
305
|
-
|
338
|
+
if printout_output
|
339
|
+
stdout.each_char do |character|
|
340
|
+
$stdout.print character
|
341
|
+
ret << character
|
342
|
+
end
|
343
|
+
else
|
344
|
+
stdout.each do |line|
|
345
|
+
log line
|
346
|
+
ret << line
|
347
|
+
end
|
306
348
|
end
|
307
349
|
end
|
308
350
|
|
@@ -336,6 +378,20 @@ module Svn2Git
|
|
336
378
|
str.gsub("'", "'\\\\''")
|
337
379
|
end
|
338
380
|
|
381
|
+
def git_config_command
|
382
|
+
if @git_config_command.nil?
|
383
|
+
status = run_command('git config --local --get user.name', false)
|
384
|
+
|
385
|
+
@git_config_command = if status =~ /unknown option/m
|
386
|
+
'git config'
|
387
|
+
else
|
388
|
+
'git config --local'
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
@git_config_command
|
393
|
+
end
|
394
|
+
|
339
395
|
end
|
340
396
|
end
|
341
397
|
|
data/svn2git.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: svn2git 2.2.4 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "svn2git"
|
8
|
-
s.version = "2.2.
|
9
|
+
s.version = "2.2.4"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["James Coglan", "Kevin Menard"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-03-09"
|
13
15
|
s.email = "nirvdrum@gmail.com"
|
14
16
|
s.executables = ["svn2git"]
|
15
17
|
s.extra_rdoc_files = [
|
@@ -29,17 +31,7 @@ Gem::Specification.new do |s|
|
|
29
31
|
"svn2git.gemspec"
|
30
32
|
]
|
31
33
|
s.homepage = "https://www.negativetwenty.net/redmine/projects/svn2git"
|
32
|
-
s.
|
33
|
-
s.rubygems_version = "1.8.23"
|
34
|
+
s.rubygems_version = "2.2.0"
|
34
35
|
s.summary = "A tool for migrating svn projects to git"
|
35
|
-
|
36
|
-
if s.respond_to? :specification_version then
|
37
|
-
s.specification_version = 3
|
38
|
-
|
39
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
-
else
|
41
|
-
end
|
42
|
-
else
|
43
|
-
end
|
44
36
|
end
|
45
37
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svn2git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.2.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- James Coglan
|
@@ -10,7 +9,7 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description:
|
16
15
|
email: nirvdrum@gmail.com
|
@@ -33,26 +32,25 @@ files:
|
|
33
32
|
- svn2git.gemspec
|
34
33
|
homepage: https://www.negativetwenty.net/redmine/projects/svn2git
|
35
34
|
licenses: []
|
35
|
+
metadata: {}
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
40
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
41
|
requirements:
|
43
|
-
- -
|
42
|
+
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
46
|
requirements:
|
49
|
-
- -
|
47
|
+
- - ">="
|
50
48
|
- !ruby/object:Gem::Version
|
51
49
|
version: '0'
|
52
50
|
requirements: []
|
53
51
|
rubyforge_project:
|
54
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.2.0
|
55
53
|
signing_key:
|
56
|
-
specification_version:
|
54
|
+
specification_version: 4
|
57
55
|
summary: A tool for migrating svn projects to git
|
58
56
|
test_files: []
|