diff --git a/ChangeLog.markdown b/ChangeLog.markdown index f8d7239..1c2afe5 100644 --- a/ChangeLog.markdown +++ b/ChangeLog.markdown @@ -1,3 +1,9 @@ +# 2.4.1 - 2021-12-17 + + Since 'git-svn' does not support '--password' anymore, this release modifies the mechanism to supply a password when needed. + + * Removed support for '--password' option (jesteves; PR merge pending). + * Added support for detecting and using the value of the environment variable 'SVN2GIT_PASSWORD' when `svn git` is invoked (jesteves; PR merge pending). # 2.4.0 - 2016-10-30 This release introduces the ability to supply a password for SVN repositories that can't authenticate by other means. diff --git a/README.markdown b/README.markdown index 7b1165c..2067570 100644 --- a/README.markdown +++ b/README.markdown @@ -120,7 +120,8 @@ one of them. If this doesn't cooperate and you need to specify a password on the command-line: - $ svn2git http://svn.example.com/path/to/repo --username <> --password <> + $ # define environment variable SVN2GIT_PASSWORD=<> according to shell syntax + $ svn2git http://svn.example.com/path/to/repo --username <> 8. You need to migrate starting at a specific svn revision number. @@ -206,7 +207,6 @@ Options Reference Specific options: --rebase Instead of cloning a new project, rebase an existing one against SVN --username NAME Username for transports that needs it (http(s), svn) - --password PASS Password for transports that needs it (http(s), svn) --trunk TRUNK_PATH Subpath to trunk from repository URL (default: trunk) --branches BRANCHES_PATH Subpath to branches from repository URL (default: branches); can be used multiple times --tags TAGS_PATH Subpath to tags from repository URL (default: tags); can be used multiple times diff --git a/VERSION.yml b/VERSION.yml index 900900f..16f56b8 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- :major: 2 :minor: 4 -:patch: 0 +:patch: 1 :build: diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 4de8a9e..e6ceb91 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -52,7 +52,6 @@ def parse(args) options[:exclude] = [] options[:revision] = nil options[:username] = nil - options[:password] = nil options[:rebasebranch] = false if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE)) @@ -75,10 +74,6 @@ def parse(args) options[:username] = username end - opts.on('--password PASSWORD', 'Password for transports that need it (http(s), svn)') do |password| - options[:password] = password - end - opts.on('--trunk TRUNK_PATH', 'Subpath to trunk from repository URL (default: trunk)') do |trunk| options[:trunk] = trunk end @@ -177,13 +172,11 @@ def clone! exclude = @options[:exclude] revision = @options[:revision] username = @options[:username] - password = @options[:password] if rootistrunk # Non-standard repository layout. The repository root is effectively 'trunk.' cmd = "git svn init --prefix=svn/ " cmd += "--username='#{username}' " unless username.nil? - cmd += "--password='#{password}' " unless password.nil? cmd += "--no-metadata " unless metadata if nominimizeurl cmd += "--no-minimize-url " @@ -196,7 +189,6 @@ def clone! # Add each component to the command that was passed as an argument. cmd += "--username='#{username}' " unless username.nil? - cmd += "--password='#{password}' " unless password.nil? cmd += "--no-metadata " unless metadata if nominimizeurl cmd += "--no-minimize-url " @@ -393,6 +385,15 @@ def optimize_repos end def run_command(cmd, exit_on_error=true, printout_output=false) + if ( ( cmd =~ /^git[ ]svn/ ) and ( ENV.key?('SVN2GIT_PASSWORD') ) ) + password = ENV['SVN2GIT_PASSWORD'] + cmd = "echo #{password} | " + cmd + end + + _run_command( cmd, exit_on_error, printout_output ) + end + + def _run_command(cmd, exit_on_error=true, printout_output=false) log "Running command: #{cmd}\n" ret = ''