Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-svn: move authentication prompts into their own namespace
author
Eric Wong
<normalperson@yhbt.net>
Thu, 4 Jan 2007 08:45:03 +0000
(
00:45
-0800)
committer
Eric Wong
<normalperson@yhbt.net>
Fri, 23 Feb 2007 08:57:08 +0000
(
00:57
-0800)
I'm going to be reorganizing some more code.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
ef1a5c2
)
diff --git
a/git-svn.perl
b/git-svn.perl
index d792a62d7ca400145d57189b5ca8af97978fef4d..cbe4ed2050fd7dc66f74f3c436e50a06ab92ffcf 100755
(executable)
--- a/
git-svn.perl
+++ b/
git-svn.perl
@@
-69,7
+69,7
@@
$_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
$_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
- $_
username, $_config_dir, $_no_auth_cache
,
+ $_
config_dir
,
$_pager, $_color, $_prefix);
my (@_branch_from, %tree_map, %users, %rusers, %equiv);
my ($_svn_can_do_switch);
$_pager, $_color, $_prefix);
my (@_branch_from, %tree_map, %users, %rusers, %equiv);
my ($_svn_can_do_switch);
@@
-83,9
+83,9
@@
'repack:i' => \$_repack,
'no-metadata' => \$_no_metadata,
'quiet|q' => \$_q,
'repack:i' => \$_repack,
'no-metadata' => \$_no_metadata,
'quiet|q' => \$_q,
- 'username=s' => \$_username,
+ 'username=s' => \$
Git::SVN::Prompt::
_username,
'config-dir=s' => \$_config_dir,
'config-dir=s' => \$_config_dir,
- 'no-auth-cache' => \$_no_auth_cache,
+ 'no-auth-cache' => \$
Git::SVN::Prompt::
_no_auth_cache,
'ignore-nodate' => \$_ignore_nodate,
'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
'ignore-nodate' => \$_ignore_nodate,
'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
@@
-131,9
+131,9
@@
'Initialize multiple trees (like git-svnimport)',
{ %multi_opts, %init_opts,
'revision|r=i' => \$_revision,
'Initialize multiple trees (like git-svnimport)',
{ %multi_opts, %init_opts,
'revision|r=i' => \$_revision,
- 'username=s' => \$_username,
+ 'username=s' => \$
Git::SVN::Prompt::
_username,
'config-dir=s' => \$_config_dir,
'config-dir=s' => \$_config_dir,
- 'no-auth-cache' => \$_no_auth_cache,
+ 'no-auth-cache' => \$
Git::SVN::Prompt::
_no_auth_cache,
'prefix=s' => \$_prefix,
} ],
'multi-fetch' => [ \&multi_fetch,
'prefix=s' => \$_prefix,
} ],
'multi-fetch' => [ \&multi_fetch,
@@
-1912,7
+1912,13
@@
sub show_commit_normal {
}
}
}
}
-sub _simple_prompt {
+package Git::SVN::Prompt;
+use strict;
+use warnings;
+require SVN::Core;
+use vars qw/$_no_auth_cache $_username/;
+
+sub simple {
my ($cred, $realm, $default_username, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
$default_username = $_username if defined $_username;
my ($cred, $realm, $default_username, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
$default_username = $_username if defined $_username;
@@
-1923,7
+1929,7
@@
sub _simple_prompt {
}
$cred->username($default_username);
} else {
}
$cred->username($default_username);
} else {
-
_username_prompt
($cred, $realm, $may_save, $pool);
+
username
($cred, $realm, $may_save, $pool);
}
$cred->password(_read_password("Password for '" .
$cred->username . "': ", $realm));
}
$cred->password(_read_password("Password for '" .
$cred->username . "': ", $realm));
@@
-1931,7
+1937,7
@@
sub _simple_prompt {
$SVN::_Core::SVN_NO_ERROR;
}
$SVN::_Core::SVN_NO_ERROR;
}
-sub
_ssl_server_trust_promp
t {
+sub
ssl_server_trus
t {
my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
print STDERR "Error validating server certificate for '$realm':\n";
my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
print STDERR "Error validating server certificate for '$realm':\n";
@@
-1980,7
+1986,7
@@
sub _ssl_server_trust_prompt {
$SVN::_Core::SVN_NO_ERROR;
}
$SVN::_Core::SVN_NO_ERROR;
}
-sub
_ssl_client_cert_promp
t {
+sub
ssl_client_cer
t {
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
print STDERR "Client certificate filename: ";
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
print STDERR "Client certificate filename: ";
@@
-1991,7
+1997,7
@@
sub _ssl_client_cert_prompt {
$SVN::_Core::SVN_NO_ERROR;
}
$SVN::_Core::SVN_NO_ERROR;
}
-sub
_ssl_client_cert_pw_prompt
{
+sub
ssl_client_cert_pw
{
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
$cred->password(_read_password("Password: ", $realm));
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
$cred->password(_read_password("Password: ", $realm));
@@
-1999,7
+2005,7
@@
sub _ssl_client_cert_pw_prompt {
$SVN::_Core::SVN_NO_ERROR;
}
$SVN::_Core::SVN_NO_ERROR;
}
-sub
_username_prompt
{
+sub
username
{
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
if (defined $realm && length $realm) {
my ($cred, $realm, $may_save, $pool) = @_;
$may_save = undef if $_no_auth_cache;
if (defined $realm && length $realm) {
@@
-2035,6
+2041,8
@@
sub _read_password {
$password;
}
$password;
}
+package main;
+
sub libsvn_connect {
my ($url) = @_;
SVN::_Core::svn_config_ensure($_config_dir, undef);
sub libsvn_connect {
my ($url) = @_;
SVN::_Core::svn_config_ensure($_config_dir, undef);
@@
-2042,16
+2050,16
@@
sub libsvn_connect {
SVN::Client::get_simple_provider(),
SVN::Client::get_ssl_server_trust_file_provider(),
SVN::Client::get_simple_prompt_provider(
SVN::Client::get_simple_provider(),
SVN::Client::get_ssl_server_trust_file_provider(),
SVN::Client::get_simple_prompt_provider(
- \&
_simple_prompt
, 2),
+ \&
Git::SVN::Prompt::simple
, 2),
SVN::Client::get_ssl_client_cert_prompt_provider(
SVN::Client::get_ssl_client_cert_prompt_provider(
- \&
_ssl_client_cert_promp
t, 2),
+ \&
Git::SVN::Prompt::ssl_client_cer
t, 2),
SVN::Client::get_ssl_client_cert_pw_prompt_provider(
SVN::Client::get_ssl_client_cert_pw_prompt_provider(
- \&
_ssl_client_cert_pw_prompt
, 2),
+ \&
Git::SVN::Prompt::ssl_client_cert_pw
, 2),
SVN::Client::get_username_provider(),
SVN::Client::get_ssl_server_trust_prompt_provider(
SVN::Client::get_username_provider(),
SVN::Client::get_ssl_server_trust_prompt_provider(
- \&
_ssl_server_trust_promp
t),
+ \&
Git::SVN::Prompt::ssl_server_trus
t),
SVN::Client::get_username_prompt_provider(
SVN::Client::get_username_prompt_provider(
- \&
_username_prompt
, 2),
+ \&
Git::SVN::username
, 2),
]);
my $config = SVN::Core::config_get_config($_config_dir);
my $ra = SVN::Ra->new(url => $url, auth => $baton,
]);
my $config = SVN::Core::config_get_config($_config_dir);
my $ra = SVN::Ra->new(url => $url, auth => $baton,