svn2git 1.3.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.markdown +13 -0
- data/README.markdown +13 -1
- data/VERSION.yml +3 -3
- data/lib/svn2git/blah.rb +4 -0
- data/lib/svn2git/migration.rb +43 -11
- data/svn2git.gemspec +5 -4
- metadata +12 -6
data/ChangeLog.markdown
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# 2.0.0 - 2010-05-29
|
2
|
+
|
3
|
+
This release adds the oft requested incremental SVN update support. If you run svn2git with the `--rebase` option on an existing
|
4
|
+
repository that you've converted with svn2git, it will fetch new branches & tags from SVN and update existing ones. There are
|
5
|
+
two important things to note:
|
6
|
+
|
7
|
+
* This will not work on already converted repositories because the tracking information isn't set up correctly. You could do that
|
8
|
+
yourself, but it's probably a lot easier to do the conversion over.
|
9
|
+
* svn2git now maintains remote tracking information. If this is a problem for you because you don't want any links to the SVN server
|
10
|
+
you can either stick with a 1.x release of svn2git or simply clone the repo created with svn2git, which will lose the tracking information.
|
11
|
+
|
12
|
+
A great deal of thanks to Nathaniel McCallum (npmccallum) for coming up with an elegant solution and then providing the patch for this release.
|
13
|
+
|
1
14
|
# 1.3.3 - 2010-03-31
|
2
15
|
|
3
16
|
Thanks to Jeff Ramnani (jramnani) for finding a problem with with the --excludes tag and providing a patch.
|
data/README.markdown
CHANGED
@@ -74,7 +74,9 @@ Make sure you have git, ruby and rubygems installed, then install the gem:
|
|
74
74
|
Usage
|
75
75
|
-----
|
76
76
|
|
77
|
-
|
77
|
+
### Initial Conversion ###
|
78
|
+
|
79
|
+
There are several ways you can create a git repo from an existing
|
78
80
|
svn repo. The differentiating factor is the svn repo layout. Below is an
|
79
81
|
enumerated listing of the varying supported layouts and the proper way to
|
80
82
|
create a git repo from a svn repo in the specified layout.
|
@@ -114,6 +116,16 @@ specified trunk=foo branches=bar and tags=foobar it would be referencing
|
|
114
116
|
http://svn.example.com/path/to/repo/foo as your trunk, and so on. However, in
|
115
117
|
case 4 it references the root of the repo as trunk.
|
116
118
|
|
119
|
+
### Repository Updates ###
|
120
|
+
|
121
|
+
As of svn2git 2.0 there is a new feature to pull in the latest changes from SVN into your
|
122
|
+
git repository created with svn2git. This is a one way sync, but allows you to use svn2git
|
123
|
+
as a mirroring tool for your SVN repositories.
|
124
|
+
|
125
|
+
The command to call is:
|
126
|
+
|
127
|
+
$ cd <EXISTING_REPO> && svn2git --rebase
|
128
|
+
|
117
129
|
Authors
|
118
130
|
-------
|
119
131
|
|
data/VERSION.yml
CHANGED
data/lib/svn2git/blah.rb
ADDED
data/lib/svn2git/migration.rb
CHANGED
@@ -10,14 +10,22 @@ module Svn2Git
|
|
10
10
|
|
11
11
|
def initialize(args)
|
12
12
|
@options = parse(args)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
if @options[:rebase]
|
14
|
+
show_help_message('Too many arguments') if args.size > 0
|
15
|
+
verify_working_tree_is_clean
|
16
|
+
else
|
17
|
+
show_help_message('Missing SVN_URL parameter') if args.empty?
|
18
|
+
show_help_message('Too many arguments') if args.size > 1
|
19
|
+
@url = args.first
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
def run!
|
20
|
-
|
24
|
+
if @options[:rebase]
|
25
|
+
get_branches
|
26
|
+
else
|
27
|
+
clone!
|
28
|
+
end
|
21
29
|
fix_tags
|
22
30
|
fix_branches
|
23
31
|
fix_trunk
|
@@ -46,6 +54,10 @@ module Svn2Git
|
|
46
54
|
opts.separator ''
|
47
55
|
opts.separator 'Specific options:'
|
48
56
|
|
57
|
+
opts.on('--rebase', 'Instead of cloning a new project, rebase an existing one against SVN') do
|
58
|
+
options[:rebase] = true
|
59
|
+
end
|
60
|
+
|
49
61
|
opts.on('--trunk TRUNK_PATH', 'Subpath to trunk from repository URL (default: trunk)') do |trunk|
|
50
62
|
options[:trunk] = trunk
|
51
63
|
end
|
@@ -150,8 +162,12 @@ module Svn2Git
|
|
150
162
|
end
|
151
163
|
|
152
164
|
def get_branches
|
153
|
-
|
154
|
-
|
165
|
+
# Get the list of local and remote branches, taking care to ignore console color codes and ignoring the
|
166
|
+
# '*' character used to indicate the currently selected branch.
|
167
|
+
@local = run_command("git branch -l --no-color").split(/\n/).collect{ |b| b.gsub(/\*/,'').strip }
|
168
|
+
@remote = run_command("git branch -r --no-color").split(/\n/).collect{ |b| b.gsub(/\*/,'').strip }
|
169
|
+
|
170
|
+
# Tags are remote branches that start with "tags/".
|
155
171
|
@tags = @remote.find_all { |b| b.strip =~ %r{^tags\/} }
|
156
172
|
end
|
157
173
|
|
@@ -173,20 +189,28 @@ module Svn2Git
|
|
173
189
|
svn_branches = @remote.find_all { |b| not @tags.include?(b) }
|
174
190
|
svn_branches.each do |branch|
|
175
191
|
branch = branch.strip
|
176
|
-
next if branch == 'trunk'
|
177
192
|
|
193
|
+
if @options[:rebase] && (@local.include?(branch) || branch == 'trunk')
|
194
|
+
branch = 'master' if branch == 'trunk'
|
195
|
+
run_command("git checkout -f #{branch}")
|
196
|
+
run_command("git svn rebase")
|
197
|
+
next
|
198
|
+
end
|
199
|
+
|
200
|
+
next if branch == 'trunk'
|
201
|
+
run_command("git branch -t #{branch} remotes/#{branch}")
|
178
202
|
run_command("git checkout #{branch}")
|
179
|
-
run_command("git checkout -b #{branch}")
|
180
203
|
end
|
181
204
|
end
|
182
205
|
|
183
206
|
def fix_trunk
|
184
207
|
trunk = @remote.find { |b| b.strip == 'trunk' }
|
185
|
-
if trunk
|
208
|
+
if trunk && ! @options[:rebase]
|
186
209
|
run_command("git checkout trunk")
|
187
210
|
run_command("git branch -D master")
|
188
211
|
run_command("git checkout -f -b master")
|
189
|
-
|
212
|
+
else
|
213
|
+
run_command("git checkout -f master")
|
190
214
|
end
|
191
215
|
end
|
192
216
|
|
@@ -218,6 +242,14 @@ module Svn2Git
|
|
218
242
|
puts @opts.help
|
219
243
|
exit
|
220
244
|
end
|
245
|
+
|
246
|
+
def verify_working_tree_is_clean
|
247
|
+
status = run_command('git status --porcelain --untracked-files=no')
|
248
|
+
unless status.strip == ''
|
249
|
+
puts 'You have local pending changes. The working tree must be clean in order to continue.'
|
250
|
+
exit
|
251
|
+
end
|
252
|
+
end
|
221
253
|
|
222
254
|
def escape_quotes(str)
|
223
255
|
str.gsub("'", "'\\\\''")
|
data/svn2git.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{svn2git}
|
8
|
-
s.version = "
|
8
|
+
s.version = "2.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James Coglan", "Kevin Menard"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-29}
|
13
13
|
s.default_executable = %q{svn2git}
|
14
14
|
s.email = %q{nirvdrum@gmail.com}
|
15
15
|
s.executables = ["svn2git"]
|
@@ -26,20 +26,21 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION.yml",
|
27
27
|
"bin/svn2git",
|
28
28
|
"lib/svn2git.rb",
|
29
|
+
"lib/svn2git/blah.rb",
|
29
30
|
"lib/svn2git/migration.rb",
|
30
31
|
"svn2git.gemspec"
|
31
32
|
]
|
32
33
|
s.homepage = %q{https://www.negativetwenty.net/redmine/projects/svn2git}
|
33
34
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
35
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.
|
36
|
+
s.rubygems_version = %q{1.3.7}
|
36
37
|
s.summary = %q{A tool for migrating svn projects to git}
|
37
38
|
|
38
39
|
if s.respond_to? :specification_version then
|
39
40
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
40
41
|
s.specification_version = 3
|
41
42
|
|
42
|
-
if Gem::Version.new(Gem::
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
44
|
else
|
44
45
|
end
|
45
46
|
else
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svn2git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- James Coglan
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-05-29 00:00:00 -04:00
|
19
20
|
default_executable: svn2git
|
20
21
|
dependencies: []
|
21
22
|
|
@@ -37,6 +38,7 @@ files:
|
|
37
38
|
- VERSION.yml
|
38
39
|
- bin/svn2git
|
39
40
|
- lib/svn2git.rb
|
41
|
+
- lib/svn2git/blah.rb
|
40
42
|
- lib/svn2git/migration.rb
|
41
43
|
- svn2git.gemspec
|
42
44
|
has_rdoc: true
|
@@ -49,23 +51,27 @@ rdoc_options:
|
|
49
51
|
require_paths:
|
50
52
|
- lib
|
51
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
52
55
|
requirements:
|
53
56
|
- - ">="
|
54
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
55
59
|
segments:
|
56
60
|
- 0
|
57
61
|
version: "0"
|
58
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
59
64
|
requirements:
|
60
65
|
- - ">="
|
61
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
62
68
|
segments:
|
63
69
|
- 0
|
64
70
|
version: "0"
|
65
71
|
requirements: []
|
66
72
|
|
67
73
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.7
|
69
75
|
signing_key:
|
70
76
|
specification_version: 3
|
71
77
|
summary: A tool for migrating svn projects to git
|