svn2git 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  pkg
2
+ .idea
data/ChangeLog.markdown CHANGED
@@ -1,3 +1,10 @@
1
+ # 1.3.2 - 2010-03-12
2
+
3
+ Thanks to rajit for finding a problem with quoting in tag comments that were causing issues with svn2git's internal
4
+ quoting and providing a patch.
5
+
6
+ * Deal cleanly with any single quotes found in tag comments so that the 'git tag' commands run correctly
7
+
1
8
  # 1.3.1 - 2009-06-09
2
9
 
3
10
  Thanks to iteman for finding a problem with the tagging process and providing a patch.
@@ -50,4 +57,4 @@
50
57
 
51
58
  # 1.0.0 - 2008-07-19
52
59
 
53
- * Forked version from jcoglan.
60
+ * Forked version from jcoglan.
data/README.markdown CHANGED
@@ -64,10 +64,12 @@ the svn repo.
64
64
  Installation
65
65
  ------------
66
66
 
67
- Make sure you have git installed, then install the gem:
67
+ Make sure you have git, ruby and rubygems installed, then install the gem:
68
68
 
69
- $ sudo apt-get install git-core git-svn
70
- $ sudo gem install nirvdrum-svn2git
69
+ $ sudo apt-get install git-core git-svn ruby rubygems
70
+ $ sudo gem install svn2git --source http://gemcutter.org
71
+
72
+ *NB: Previous versions of the gem could be installed from GitHub as nirvdrum-svn2git. You can install that gem via `$ sudo gem install nirvdrum-svn2git --source http://gems.github.com`, but the nirvdrum-svn2git gem will no longer be updated. Please use the one hosted on gemcutter.*
71
73
 
72
74
  Usage
73
75
  -----
@@ -130,6 +132,17 @@ svn2git will load it out of there. This allows you to build up one authors
130
132
  file for all your projects and have it loaded for each repository that you
131
133
  migrate.
132
134
 
135
+ If you need a jump start on figuring out what users made changes in your
136
+ svn repositories the following command sequence might help. It grabs all
137
+ the logs from the svn repository, pulls out all the names from the commits,
138
+ sorts them, and then reduces the list to only unique names. So, in the end
139
+ it outputs a list of usernames of the people that made commits to the svn
140
+ repository which name on its own line. This would allow you to easily
141
+ redirect the output of this command sequence to ~/.svn2git/authors and have
142
+ a very good starting point for your mapping.
143
+
144
+ $ svn log | grep -E "r[0-9]+ \| [a-z]+ \|" | awk '{print $3}' | sort | uniq
145
+
133
146
  Debugging
134
147
  ---------
135
148
 
@@ -169,4 +182,4 @@ FAQ
169
182
  and the resulting code base would be different then if they checked out
170
183
  that very same tag in the original svn repo. This is only due to the fact
171
184
  that the svn tags allow changesets in them, making them not just annotated
172
- tags.
185
+ tags.
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  spec.homepage = "https://www.negativetwenty.net/redmine/projects/svn2git"
11
11
  spec.email = "nirvdrum@gmail.com"
12
12
  end
13
+ Jeweler::GemcutterTasks.new
13
14
 
14
15
  rescue LoadError
15
16
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 1
3
+ :patch: 2
4
4
  :major: 1
@@ -129,7 +129,7 @@ module Svn2Git
129
129
  run_command(cmd)
130
130
  end
131
131
 
132
- run_command("git config svn.authorsfile #{authors}") if authors
132
+ run_command("git config svn.authorsfile #{authors}") unless authors.nil?
133
133
 
134
134
  cmd = "git svn fetch"
135
135
  unless exclude.empty?
@@ -150,17 +150,22 @@ module Svn2Git
150
150
  end
151
151
 
152
152
  def get_branches
153
- @remote = `git branch -r`.split(/\n/)
153
+ @local = run_command("git branch -l").split(/\n/).collect{ |b| b.strip }
154
+ @remote = run_command("git branch -r").split(/\n/).collect{ |b| b.strip }
154
155
  @tags = @remote.find_all { |b| b.strip =~ %r{^tags\/} }
155
156
  end
156
157
 
157
158
  def fix_tags
158
159
  @tags.each do |tag|
159
- id = tag.strip.gsub(%r{^tags\/}, '')
160
- subject = `git log -1 --pretty=format:"%s" #{tag.strip()}`
161
- date = `git log -1 --pretty=format:"%ci" #{tag.strip()}`
162
- run_command("GIT_COMMITTER_DATE='#{date}' git tag -a -m '#{subject}' '#{id.strip()}' '#{tag.strip()}'")
163
- run_command("git branch -d -r #{tag.strip()}")
160
+ tag = tag.strip
161
+ id = tag.gsub(%r{^tags\/}, '').strip
162
+ subject = run_command("git log -1 --pretty=format:'%s' #{tag}")
163
+ date = run_command("git log -1 --pretty=format:'%ci' #{tag}")
164
+ subject = escape_quotes(subject)
165
+ date = escape_quotes(date)
166
+ id = escape_quotes(id)
167
+ run_command("GIT_COMMITTER_DATE='#{date}' git tag -a -m '#{subject}' '#{id}' '#{escape_quotes(tag)}'")
168
+ run_command("git branch -d -r #{tag}")
164
169
  end
165
170
  end
166
171
 
@@ -169,8 +174,9 @@ module Svn2Git
169
174
  svn_branches.each do |branch|
170
175
  branch = branch.strip
171
176
  next if branch == 'trunk'
177
+
172
178
  run_command("git checkout #{branch}")
173
- run_command("git checkout -b #{branch}")
179
+ run_command("git checkout -b #{branch}")
174
180
  end
175
181
  end
176
182
 
@@ -191,11 +197,16 @@ module Svn2Git
191
197
  def run_command(cmd)
192
198
  log "Running command: #{cmd}"
193
199
 
200
+ ret = ''
201
+
194
202
  IO.popen(cmd) do |stdout|
195
203
  stdout.each do |line|
196
204
  log line
205
+ ret << line
197
206
  end
198
207
  end
208
+
209
+ ret
199
210
  end
200
211
 
201
212
  def log(msg)
@@ -208,6 +219,10 @@ module Svn2Git
208
219
  exit
209
220
  end
210
221
 
222
+ def escape_quotes(str)
223
+ str.gsub("'", "'\\\\''")
224
+ end
225
+
211
226
  end
212
227
  end
213
228
 
data/svn2git.gemspec CHANGED
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{svn2git}
5
- s.version = "1.3.1"
8
+ s.version = "1.3.2"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["James Coglan", "Kevin Menard"]
9
- s.date = %q{2009-06-09}
12
+ s.date = %q{2010-03-12}
10
13
  s.default_executable = %q{svn2git}
11
14
  s.email = %q{nirvdrum@gmail.com}
12
15
  s.executables = ["svn2git"]
@@ -29,7 +32,7 @@ Gem::Specification.new do |s|
29
32
  s.homepage = %q{https://www.negativetwenty.net/redmine/projects/svn2git}
30
33
  s.rdoc_options = ["--charset=UTF-8"]
31
34
  s.require_paths = ["lib"]
32
- s.rubygems_version = %q{1.3.4}
35
+ s.rubygems_version = %q{1.3.6}
33
36
  s.summary = %q{A tool for migrating svn projects to git}
34
37
 
35
38
  if s.respond_to? :specification_version then
@@ -42,3 +45,4 @@ Gem::Specification.new do |s|
42
45
  else
43
46
  end
44
47
  end
48
+
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn2git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 3
8
+ - 2
9
+ version: 1.3.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - James Coglan
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2009-06-09 00:00:00 -04:00
18
+ date: 2010-03-12 00:00:00 -05:00
14
19
  default_executable: svn2git
15
20
  dependencies: []
16
21
 
@@ -47,18 +52,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
52
  requirements:
48
53
  - - ">="
49
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
50
57
  version: "0"
51
- version:
52
58
  required_rubygems_version: !ruby/object:Gem::Requirement
53
59
  requirements:
54
60
  - - ">="
55
61
  - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
56
64
  version: "0"
57
- version:
58
65
  requirements: []
59
66
 
60
67
  rubyforge_project:
61
- rubygems_version: 1.3.4
68
+ rubygems_version: 1.3.6
62
69
  signing_key:
63
70
  specification_version: 3
64
71
  summary: A tool for migrating svn projects to git