mss-svn2git 1.2.4 → 1.2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +46 -45
  2. data/lib/svn2git/migration.rb +11 -12
  3. metadata +1 -1
data/README.markdown CHANGED
@@ -13,50 +13,50 @@ Examples
13
13
 
14
14
  Say I have this code in svn:
15
15
 
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
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
- $ 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 ]
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
- $ 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
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
- $ svn2git http://svn.yoursite.com/path/to/repo --trunk trunk --branches branches --tags tags
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
- $ svn2git http://svn.yoursite.com/path/to/repo --trunk trunk --tags tags
88
+ $ svn2git http://svn.example.com/path/to/repo --trunk trunk --tags tags
89
89
 
90
90
  3. The svn repo is NOT in standard layout and has only a trunk and branches at
91
91
  the root level of the repo.
92
92
 
93
- $ svn2git http://svn.yoursite.com/path/to/repo --trunk trunk --branches branches
93
+ $ svn2git http://svn.example.com/path/to/repo --trunk trunk --branches branches
94
94
 
95
95
  4. The svn repo is NOT in standard layout and has only a trunk at the root
96
96
  level of the repo.
97
97
 
98
- $ svn2git http://svn.yoursite.com/path/to/repo --trunk trunk
98
+ $ svn2git http://svn.example.com/path/to/repo --trunk trunk
99
99
 
100
100
  5. The svn repo is NOT in standard layout and has no trunk, branches, or tags
101
101
  at the root level of the repo. Instead the root level of the repo is
102
102
  equivalent to the trunk and there are no tags or branches.
103
103
 
104
- $ svn2git http://svn.yoursite.com/path/to/repo --rootistrunk
104
+ $ svn2git http://svn.example.com/path/to/repo --rootistrunk
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,7 +109,7 @@ 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.yoursite.com/path/to/repo/foo as your trunk, and so on. However, in
112
+ http://svn.example.com/path/to/repo/foo as your trunk, and so on. However, in
113
113
  case 5 it references the root of the repo as trunk.
114
114
 
115
115
  Authors
@@ -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
- jcoglan = James Coglan <jcoglan@never-you-mind.com>
122
- stnick = Santa Claus <nicholas@lapland.com>
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
- svn2git http://repos.com/myproject --authors ~/authors.txt
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,5 @@ 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
- $ svn2git http://svn.yoursite.com/path/to/repo --verbose
142
+ $ svn2git http://svn.yoursite.com/path/to/repo --verbose
143
+
@@ -61,7 +61,7 @@ module Svn2Git
61
61
  options[:authors] = authors
62
62
  end
63
63
 
64
- opts.on('--rootistrunk', 'Use this if the root level of the repo isequivalent to the trunk and there are no tags or branches') do
64
+ 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
65
65
  options[:rootistrunk] = true
66
66
  end
67
67
 
@@ -92,22 +92,20 @@ module Svn2Git
92
92
  rootistrunk = @options[:rootistrunk]
93
93
  authors = @options[:authors]
94
94
 
95
+ cmd = %w{git svn init --no-metadata}
95
96
  if rootistrunk
96
97
  # Non-standard repository layout. The repository root is effectively 'trunk.'
97
- run_command("git svn init --no-metadata --trunk=#{@url}")
98
+ cmd << "--trunk=#{@url}"
98
99
 
99
100
  else
100
- cmd = "git svn init --no-metadata "
101
-
102
101
  # Add each component to the command that was passed as an argument.
103
- cmd += "--trunk=#{trunk} " unless trunk.nil?
104
- cmd += "--tags=#{tags} " unless tags.nil?
105
- cmd += "--branches=#{branches} " unless branches.nil?
106
-
107
- cmd += @url
102
+ cmd << "--trunk=#{trunk}" unless trunk.nil?
103
+ cmd << "--tags=#{tags}" unless tags.nil?
104
+ cmd << "--branches=#{branches}" unless branches.nil?
108
105
 
109
- run_command(cmd)
106
+ cmd << @url
110
107
  end
108
+ run_command(cmd)
111
109
 
112
110
  run_command("git config svn.authorsfile #{authors}") if authors
113
111
  run_command("git svn fetch")
@@ -125,8 +123,7 @@ module Svn2Git
125
123
  id = tag.strip.gsub(%r{^#{@options[:tags]}\/}, '')
126
124
  subject = `git log -1 --pretty=format:"%s" #{tag.strip()}`
127
125
  date = `git log -1 --pretty=format:"%ci" #{tag.strip()}`
128
- `export GIT_COMMITER_DATE="#{date}"`
129
- run_command("git tag -a -m '#{subject}' '#{id.strip()}' '#{tag.strip()}'")
126
+ run_command("GIT_COMMITTER_DATE='#{date}' git tag -a -m '#{subject}' '#{id.strip()}' '#{tag.strip()}'")
130
127
  run_command("git branch -d -r #{tag.strip()}")
131
128
  end
132
129
  end
@@ -156,6 +153,8 @@ module Svn2Git
156
153
  end
157
154
 
158
155
  def run_command(cmd)
156
+ cmd = cmd.join(' ') if cmd.kind_of? Array
157
+
159
158
  log "Running command: #{cmd}"
160
159
 
161
160
  IO.popen(cmd) do |stdout|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mss-svn2git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan