Skip to content

Commit 526df23

Browse files
committed
Merge pull request #190 from edpbx/passwordoption
Add support for --password option
2 parents 7010a1f + 39704bd commit 526df23

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ one of them.
118118

119119
$ svn2git http://svn.example.com/path/to/repo --username <<user_with_perms>>
120120

121+
If this doesn't cooperate and you need to specify a password on the command-line:
122+
123+
$ svn2git http://svn.example.com/path/to/repo --username <<user_with_perms>> --password <<password>>
124+
121125
8. You need to migrate starting at a specific svn revision number.
122126

123127
$ svn2git http://svn.example.com/path/to/repo --revision <<starting_revision_number>>
@@ -202,6 +206,7 @@ Options Reference
202206
Specific options:
203207
--rebase Instead of cloning a new project, rebase an existing one against SVN
204208
--username NAME Username for transports that needs it (http(s), svn)
209+
--password PASS Password for transports that needs it (http(s), svn)
205210
--trunk TRUNK_PATH Subpath to trunk from repository URL (default: trunk)
206211
--branches BRANCHES_PATH Subpath to branches from repository URL (default: branches)
207212
--tags TAGS_PATH Subpath to tags from repository URL (default: tags)

lib/svn2git/migration.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def parse(args)
5252
options[:exclude] = []
5353
options[:revision] = nil
5454
options[:username] = nil
55+
options[:password] = nil
5556
options[:rebasebranch] = false
5657

5758
if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
@@ -74,6 +75,10 @@ def parse(args)
7475
options[:username] = username
7576
end
7677

78+
opts.on('--password PASSWORD', 'Password for transports that need it (http(s), svn)') do |password|
79+
options[:password] = password
80+
end
81+
7782
opts.on('--trunk TRUNK_PATH', 'Subpath to trunk from repository URL (default: trunk)') do |trunk|
7883
options[:trunk] = trunk
7984
end
@@ -172,11 +177,13 @@ def clone!
172177
exclude = @options[:exclude]
173178
revision = @options[:revision]
174179
username = @options[:username]
180+
password = @options[:password]
175181

176182
if rootistrunk
177183
# Non-standard repository layout. The repository root is effectively 'trunk.'
178184
cmd = "git svn init --prefix=svn/ "
179185
cmd += "--username=#{username} " unless username.nil?
186+
cmd += "--password=#{password} " unless password.nil?
180187
cmd += "--no-metadata " unless metadata
181188
if nominimizeurl
182189
cmd += "--no-minimize-url "
@@ -189,6 +196,7 @@ def clone!
189196

190197
# Add each component to the command that was passed as an argument.
191198
cmd += "--username=#{username} " unless username.nil?
199+
cmd += "--password=#{password} " unless password.nil?
192200
cmd += "--no-metadata " unless metadata
193201
if nominimizeurl
194202
cmd += "--no-minimize-url "

0 commit comments

Comments
 (0)