@@ -2,6 +2,7 @@ package Git::SVN::Ra;
22use vars qw/ @ISA $config_dir $_ignore_refs_regex $_log_window_size/ ;
33use strict;
44use warnings;
5+ use Memoize;
56use SVN::Client;
67use Git::SVN::Utils qw(
78 canonicalize_url
@@ -76,6 +77,40 @@ sub _auth_providers () {
7677 \@rv ;
7778}
7879
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+ }
79114
80115sub new {
81116 my ($class , $url ) = @_ ;
@@ -84,34 +119,8 @@ sub new {
84119
85120 ::_req_svn();
86121
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 );
90122 $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();
115124 my $self = SVN::Ra-> new(url => $url , auth => $baton ,
116125 config => $config ,
117126 pool => SVN::Pool-> new,
0 commit comments