@@ -2,6 +2,7 @@ package Git::SVN::Ra;
2
2
use vars qw/ @ISA $config_dir $_ignore_refs_regex $_log_window_size/ ;
3
3
use strict;
4
4
use warnings;
5
+ use Memoize;
5
6
use SVN::Client;
6
7
use Git::SVN::Utils qw(
7
8
canonicalize_url
@@ -76,6 +77,40 @@ sub _auth_providers () {
76
77
\@rv ;
77
78
}
78
79
80
+ sub prepare_config_once {
81
+ SVN::_Core::svn_config_ensure($config_dir , undef );
82
+ my ($baton , $callbacks ) = SVN::Core::auth_open_helper(_auth_providers);
83
+ my $config = SVN::Core::config_get_config($config_dir );
84
+ my $dont_store_passwords = 1;
85
+ my $conf_t = $config -> {' config' };
86
+
87
+ no warnings ' once' ;
88
+ # The usage of $SVN::_Core::SVN_CONFIG_* variables
89
+ # produces warnings that variables are used only once.
90
+ # I had not found the better way to shut them up, so
91
+ # the warnings of type 'once' are disabled in this block.
92
+ if (SVN::_Core::svn_config_get_bool($conf_t ,
93
+ $SVN::_Core::SVN_CONFIG_SECTION_AUTH ,
94
+ $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS ,
95
+ 1) == 0) {
96
+ SVN::_Core::svn_auth_set_parameter($baton ,
97
+ $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS ,
98
+ bless (\$dont_store_passwords , " _p_void" ));
99
+ }
100
+ if (SVN::_Core::svn_config_get_bool($conf_t ,
101
+ $SVN::_Core::SVN_CONFIG_SECTION_AUTH ,
102
+ $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS ,
103
+ 1) == 0) {
104
+ $Git::SVN::Prompt::_no_auth_cache = 1;
105
+ }
106
+
107
+ return ($config , $baton , $callbacks );
108
+ } # no warnings 'once'
109
+
110
+ INIT {
111
+ Memoize::memoize ' _auth_providers' ;
112
+ Memoize::memoize ' prepare_config_once' ;
113
+ }
79
114
80
115
sub new {
81
116
my ($class , $url ) = @_ ;
@@ -84,34 +119,8 @@ sub new {
84
119
85
120
::_req_svn();
86
121
87
- SVN::_Core::svn_config_ensure($config_dir , undef );
88
- my ($baton , $callbacks ) = SVN::Core::auth_open_helper(_auth_providers);
89
- my $config = SVN::Core::config_get_config($config_dir );
90
122
$RA = undef ;
91
- my $dont_store_passwords = 1;
92
- my $conf_t = ${$config} {' config' };
93
- {
94
- no warnings ' once' ;
95
- # The usage of $SVN::_Core::SVN_CONFIG_* variables
96
- # produces warnings that variables are used only once.
97
- # I had not found the better way to shut them up, so
98
- # the warnings of type 'once' are disabled in this block.
99
- if (SVN::_Core::svn_config_get_bool($conf_t ,
100
- $SVN::_Core::SVN_CONFIG_SECTION_AUTH ,
101
- $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS ,
102
- 1) == 0) {
103
- SVN::_Core::svn_auth_set_parameter($baton ,
104
- $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS ,
105
- bless (\$dont_store_passwords , " _p_void" ));
106
- }
107
- if (SVN::_Core::svn_config_get_bool($conf_t ,
108
- $SVN::_Core::SVN_CONFIG_SECTION_AUTH ,
109
- $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS ,
110
- 1) == 0) {
111
- $Git::SVN::Prompt::_no_auth_cache = 1;
112
- }
113
- } # no warnings 'once'
114
-
123
+ my ($config , $baton , $callbacks ) = prepare_config_once();
115
124
my $self = SVN::Ra-> new(url => $url , auth => $baton ,
116
125
config => $config ,
117
126
pool => SVN::Pool-> new,
0 commit comments