nirvdrum-svn2git 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/ChangeLog.markdown +21 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +82 -52
- data/VERSION.yml +2 -2
- data/lib/svn2git/migration.rb +39 -6
- data/svn2git.gemspec +44 -0
- metadata +6 -3
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/ChangeLog.markdown
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# 1.3.0 - 2009-06-09
|
2
|
+
|
3
|
+
Many thanks to mss for the patches making up most of this release.
|
4
|
+
|
5
|
+
* Fixed a problem where tags didn't get the original date and time.
|
6
|
+
* New switch --exclude which can be used to specify a PCRE pattern to exclude paths from the import.
|
7
|
+
* New switches --no{trunk,branches,tags} to skip import of those.
|
8
|
+
* Improved docs.
|
9
|
+
|
10
|
+
# 1.2.4 - 2009-05-04
|
11
|
+
|
12
|
+
* No changes. I ran the jeweler command twice inadvertently. Tearing down the release would be more harmful than helpful.
|
13
|
+
|
14
|
+
# 1.2.3 - 2009-05-04
|
15
|
+
|
16
|
+
* Yanked out the code referencing the gem by name. This shouldn't be necessary at all.
|
17
|
+
|
18
|
+
# 1.2.2 - 2009-05-04
|
19
|
+
|
20
|
+
* Updated the reference gem in the binary to use this one and not the one on RubyForge.
|
21
|
+
|
1
22
|
# 1.2.1 - 2009-04-19
|
2
23
|
|
3
24
|
* Fixed a problem with the svn2git binary not loading command-line args properly.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 James Coglan, Kevin Menard
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
data/README.markdown
CHANGED
@@ -13,50 +13,50 @@ Examples
|
|
13
13
|
|
14
14
|
Say I have this code in svn:
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
trunk
|
17
|
+
...
|
18
|
+
branches
|
19
|
+
1.x
|
20
|
+
2.x
|
21
|
+
tags
|
22
|
+
1.0.0
|
23
|
+
1.0.1
|
24
|
+
1.0.2
|
25
|
+
1.1.0
|
26
|
+
2.0.0
|
27
27
|
|
28
28
|
git-svn will go through the commit history to build a new git repo. It will
|
29
29
|
import all branches and tags as remote svn branches, whereas what you really
|
30
30
|
want is git-native local branches and git tag objects. So after importing this
|
31
31
|
project I'll get:
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
$ git branch
|
34
|
+
* master
|
35
|
+
$ git branch -a
|
36
|
+
* master
|
37
|
+
1.x
|
38
|
+
2.x
|
39
|
+
tags/1.0.0
|
40
|
+
tags/1.0.1
|
41
|
+
tags/1.0.2
|
42
|
+
tags/1.1.0
|
43
|
+
tags/2.0.0
|
44
|
+
trunk
|
45
|
+
$ git tag -l
|
46
|
+
[ empty ]
|
47
47
|
|
48
48
|
After svn2git is done with your project, you'll get this instead:
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
$ git branch
|
51
|
+
* master
|
52
|
+
1.x
|
53
|
+
2.x
|
54
|
+
$ git tag -l
|
55
|
+
1.0.0
|
56
|
+
1.0.1
|
57
|
+
1.0.2
|
58
|
+
1.1.0
|
59
|
+
2.0.0
|
60
60
|
|
61
61
|
Finally, it makes sure the HEAD of master is the same as the current trunk of
|
62
62
|
the svn repo.
|
@@ -80,28 +80,28 @@ create a git repo from a svn repo in the specified layout.
|
|
80
80
|
1. The svn repo is in the standard layout of (trunk, branches, tags) at the
|
81
81
|
root level of the repo.
|
82
82
|
|
83
|
-
|
83
|
+
$ svn2git http://svn.example.com/path/to/repo
|
84
84
|
|
85
85
|
2. The svn repo is NOT in standard layout and has only a trunk and tags at the
|
86
86
|
root level of the repo.
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
3. The svn repo is NOT in standard layout and has only a trunk and branches at
|
91
|
-
the root level of the repo.
|
88
|
+
$ svn2git http://svn.example.com/path/to/repo --trunk dev --tags rel --nobranches
|
92
89
|
|
93
|
-
|
94
|
-
|
95
|
-
4. The svn repo is NOT in standard layout and has only a trunk at the root
|
90
|
+
3. The svn repo is NOT in standard layout and has only a trunk at the root
|
96
91
|
level of the repo.
|
97
92
|
|
98
|
-
|
93
|
+
$ svn2git http://svn.example.com/path/to/repo --trunk trunk --nobranches --notags
|
99
94
|
|
100
|
-
|
95
|
+
4. The svn repo is NOT in standard layout and has no trunk, branches, or tags
|
101
96
|
at the root level of the repo. Instead the root level of the repo is
|
102
97
|
equivalent to the trunk and there are no tags or branches.
|
103
98
|
|
104
|
-
|
99
|
+
$ svn2git http://svn.example.com/path/to/repo --rootistrunk
|
100
|
+
|
101
|
+
5. The svn repo is in the standard layout but you want to exclude the massive
|
102
|
+
doc directory and the backup files you once accidently added.
|
103
|
+
|
104
|
+
$ svn2git http://svn.example.com/path/to/repo --exclude doc --exclude '.*~$'
|
105
105
|
|
106
106
|
The above will create a git repository in the current directory with the git
|
107
107
|
version of the svn repository. Hence, you need to make a directory that you
|
@@ -109,8 +109,8 @@ want your new git repo to exist in, change into it and then run one of the
|
|
109
109
|
above commands. Note that in the above cases the trunk, branches, tags options
|
110
110
|
are simply folder names relative to the provided repo path. For example if you
|
111
111
|
specified trunk=foo branches=bar and tags=foobar it would be referencing
|
112
|
-
http://svn.
|
113
|
-
case
|
112
|
+
http://svn.example.com/path/to/repo/foo as your trunk, and so on. However, in
|
113
|
+
case 4 it references the root of the repo as trunk.
|
114
114
|
|
115
115
|
Authors
|
116
116
|
-------
|
@@ -118,12 +118,12 @@ Authors
|
|
118
118
|
To convert all your svn authors to git format, create a file somewhere on your
|
119
119
|
system with the list of conversions to make, one per line, for example:
|
120
120
|
|
121
|
-
|
122
|
-
|
121
|
+
jcoglan = James Coglan <jcoglan@never-you-mind.com>
|
122
|
+
stnick = Santa Claus <nicholas@lapland.com>
|
123
123
|
|
124
124
|
Then pass an +authors+ option to +svn2git+ pointing to your file:
|
125
125
|
|
126
|
-
|
126
|
+
$ svn2git http://svn.example.com/path/to/repo --authors ~/authors.txt
|
127
127
|
|
128
128
|
Alternatively, you can place the authors file into ~/.svn2git/authors and
|
129
129
|
svn2git will load it out of there. This allows you to build up one authors
|
@@ -139,4 +139,34 @@ underlying git-svn process.
|
|
139
139
|
|
140
140
|
You can turn on verbose logging with the '-v' or '--verbose' flags, like so:
|
141
141
|
|
142
|
-
|
142
|
+
$ svn2git http://svn.yoursite.com/path/to/repo --verbose
|
143
|
+
|
144
|
+
FAQ
|
145
|
+
---
|
146
|
+
|
147
|
+
1. Why don't the tags show up in the master branch?
|
148
|
+
|
149
|
+
The tags won't show up in the master branch because the tags are actually
|
150
|
+
tied to the commits that were created in svn when the user made the tag.
|
151
|
+
Those commits are the first (head) commit of branch in svn that is
|
152
|
+
associated with that tag. If you want to see all the branches and tags
|
153
|
+
and their relationships in gitk you can run the following: gitk --all
|
154
|
+
|
155
|
+
For further details please refer to FAQ #2.
|
156
|
+
|
157
|
+
2. Why don't you reference the parent of the tag commits instead?
|
158
|
+
|
159
|
+
In svn you are forced to create what are known in git as annotated tags.
|
160
|
+
It just so happens that svn annotated tags allow you to commit change
|
161
|
+
sets along with the tagging action. This means that the svn annotated tag
|
162
|
+
is a bit more complex then just an annotated tag it is a commit which is
|
163
|
+
treated as an annotated tag. Hence, for there to be a true 1-to-1 mapping
|
164
|
+
between git and svn we have to transfer over the svn commit which acts as
|
165
|
+
an annotated tag and then tag that commit in git using an annotated tag.
|
166
|
+
|
167
|
+
If we were to reference the parent of this svn tagged commit there could
|
168
|
+
potentially be situations where a developer would checkout a tag in git
|
169
|
+
and the resulting code base would be different then if they checked out
|
170
|
+
that very same tag in the original svn repo. This is only due to the fact
|
171
|
+
that the svn tags allow changesets in them, making them not just annotated
|
172
|
+
tags.
|
data/VERSION.yml
CHANGED
data/lib/svn2git/migration.rb
CHANGED
@@ -32,6 +32,7 @@ module Svn2Git
|
|
32
32
|
options[:trunk] = 'trunk'
|
33
33
|
options[:branches] = 'branches'
|
34
34
|
options[:tags] = 'tags'
|
35
|
+
options[:exclude] = []
|
35
36
|
|
36
37
|
if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
|
37
38
|
options[:authors] = DEFAULT_AUTHORS_FILE
|
@@ -52,17 +53,35 @@ module Svn2Git
|
|
52
53
|
opts.on('--branches BRANCHES_PATH', 'Subpath to branches from repository URL (default: branches)') do |branches|
|
53
54
|
options[:branches] = branches
|
54
55
|
end
|
55
|
-
|
56
56
|
opts.on('--tags TAGS_PATH', 'Subpath to tags from repository URL (default: tags)') do |tags|
|
57
57
|
options[:tags] = tags
|
58
58
|
end
|
59
59
|
|
60
|
+
opts.on('--rootistrunk', 'Use this if the root level of the repo is equivalent to the trunk and there are no tags or branches') do
|
61
|
+
options[:rootistrunk] = true
|
62
|
+
options[:trunk] = nil
|
63
|
+
options[:branches] = nil
|
64
|
+
options[:tags] = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
opts.on('--notrunk', 'Do not import anything from trunk') do
|
68
|
+
options[:trunk] = nil
|
69
|
+
end
|
70
|
+
|
71
|
+
opts.on('--nobranches', 'Do not try to import any branches') do
|
72
|
+
options[:branches] = nil
|
73
|
+
end
|
74
|
+
|
75
|
+
opts.on('--notags', 'Do not try to import any tags') do
|
76
|
+
options[:tags] = nil
|
77
|
+
end
|
78
|
+
|
60
79
|
opts.on('--authors AUTHORS_FILE', "Path to file containing svn-to-git authors mapping (default: #{DEFAULT_AUTHORS_FILE})") do |authors|
|
61
80
|
options[:authors] = authors
|
62
81
|
end
|
63
82
|
|
64
|
-
opts.on('--
|
65
|
-
options[:
|
83
|
+
opts.on('--exclude REGEX', 'Specify a Perl regular expression to filter paths when fetching; can be used multiple times') do |regex|
|
84
|
+
options[:exclude] << regex
|
66
85
|
end
|
67
86
|
|
68
87
|
opts.on('-v', '--verbose', 'Be verbose in logging -- useful for debugging issues') do
|
@@ -91,6 +110,7 @@ module Svn2Git
|
|
91
110
|
tags = @options[:tags]
|
92
111
|
rootistrunk = @options[:rootistrunk]
|
93
112
|
authors = @options[:authors]
|
113
|
+
exclude = @options[:exclude]
|
94
114
|
|
95
115
|
if rootistrunk
|
96
116
|
# Non-standard repository layout. The repository root is effectively 'trunk.'
|
@@ -110,7 +130,21 @@ module Svn2Git
|
|
110
130
|
end
|
111
131
|
|
112
132
|
run_command("git config svn.authorsfile #{authors}") if authors
|
113
|
-
|
133
|
+
|
134
|
+
cmd = "git svn fetch"
|
135
|
+
unless exclude.empty?
|
136
|
+
# Add exclude paths to the command line; some versions of git support
|
137
|
+
# this for fetch only, later also for init.
|
138
|
+
regex = []
|
139
|
+
unless rootistrunk
|
140
|
+
regex << "#{trunk}[/]" unless trunk.nil?
|
141
|
+
regex << "#{tags}[/][^/]+[/]" unless tags.nil?
|
142
|
+
regex << "#{branches}[/][^/]+[/]" unless branches.nil?
|
143
|
+
end
|
144
|
+
regex = '^(?:' + regex.join('|') + ')(?:' + exclude.join('|') + ')'
|
145
|
+
cmd += "'--ignore-paths=#{regex}'"
|
146
|
+
end
|
147
|
+
run_command(cmd)
|
114
148
|
|
115
149
|
get_branches
|
116
150
|
end
|
@@ -125,8 +159,7 @@ module Svn2Git
|
|
125
159
|
id = tag.strip.gsub(%r{^#{@options[:tags]}\/}, '')
|
126
160
|
subject = `git log -1 --pretty=format:"%s" #{tag.strip()}`
|
127
161
|
date = `git log -1 --pretty=format:"%ci" #{tag.strip()}`
|
128
|
-
|
129
|
-
run_command("git tag -a -m '#{subject}' '#{id.strip()}' '#{tag.strip()}'")
|
162
|
+
run_command("GIT_COMMITTER_DATE='#{date}' git tag -a -m '#{subject}' '#{id.strip()}' '#{tag.strip()}'")
|
130
163
|
run_command("git branch -d -r #{tag.strip()}")
|
131
164
|
end
|
132
165
|
end
|
data/svn2git.gemspec
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{svn2git}
|
5
|
+
s.version = "1.3.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["James Coglan", "Kevin Menard"]
|
9
|
+
s.date = %q{2009-06-09}
|
10
|
+
s.default_executable = %q{svn2git}
|
11
|
+
s.email = %q{nirvdrum@gmail.com}
|
12
|
+
s.executables = ["svn2git"]
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"ChangeLog.markdown",
|
15
|
+
"README.markdown"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".gitignore",
|
19
|
+
"ChangeLog.markdown",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.markdown",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION.yml",
|
24
|
+
"bin/svn2git",
|
25
|
+
"lib/svn2git.rb",
|
26
|
+
"lib/svn2git/migration.rb",
|
27
|
+
"svn2git.gemspec"
|
28
|
+
]
|
29
|
+
s.homepage = %q{https://www.negativetwenty.net/redmine/projects/svn2git}
|
30
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
s.rubygems_version = %q{1.3.4}
|
33
|
+
s.summary = %q{A tool for migrating svn projects to git}
|
34
|
+
|
35
|
+
if s.respond_to? :specification_version then
|
36
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
40
|
+
else
|
41
|
+
end
|
42
|
+
else
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nirvdrum-svn2git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-06-09 00:00:00 -07:00
|
14
14
|
default_executable: svn2git
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -24,14 +24,17 @@ extra_rdoc_files:
|
|
24
24
|
- ChangeLog.markdown
|
25
25
|
- README.markdown
|
26
26
|
files:
|
27
|
+
- .gitignore
|
27
28
|
- ChangeLog.markdown
|
29
|
+
- MIT-LICENSE
|
28
30
|
- README.markdown
|
29
31
|
- Rakefile
|
30
32
|
- VERSION.yml
|
31
33
|
- bin/svn2git
|
32
34
|
- lib/svn2git.rb
|
33
35
|
- lib/svn2git/migration.rb
|
34
|
-
|
36
|
+
- svn2git.gemspec
|
37
|
+
has_rdoc: false
|
35
38
|
homepage: https://www.negativetwenty.net/redmine/projects/svn2git
|
36
39
|
post_install_message:
|
37
40
|
rdoc_options:
|