[Bps-public-commit] r8881 - in SVKUI: . trunk/lib/SVKUI/Model
clsung at bestpractical.com
clsung at bestpractical.com
Mon Sep 3 18:51:55 EDT 2007
Author: clsung
Date: Mon Sep 3 18:51:53 2007
New Revision: 8881
Modified:
SVKUI/ (props changed)
SVKUI/trunk/lib/SVKUI.pm
SVKUI/trunk/lib/SVKUI/Model/Project.pm
Log:
r8943 at going04: clsung | 2007-09-04 06:51:55 +0800
- finally, svn auth works on SVKUI....
- again, use local* to done it *evil*
Modified: SVKUI/trunk/lib/SVKUI.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI.pm (original)
+++ SVKUI/trunk/lib/SVKUI.pm Mon Sep 3 18:51:53 2007
@@ -91,11 +91,48 @@
return SVK::Path->real_new( { depot => $depot, path => $path})->refresh_revision;
}
+our $current_user;
+our $current_pass;
sub _svkcmd {
my $class = shift;
my $cmd = shift || 'help';
my @args = @_;
+
+# local *SVK::Config::_simple_prompt = sub {
+# my ($cred, $realm, $default_username, $may_save, $pool) = @_;
+# warn "Setting user/pass to ".$current_user;
+# $cred->username($current_user);
+# $cred->password($current_pass);
+# $cred->may_save(0);
+# return $SVN::_Core::SVN_NO_ERROR;
+# };
return $class->svk->$cmd(@args);
}
+sub setup_auth {
+ my $class = shift;
+ $current_user = shift;
+ $current_pass = shift;
+ warn "Setting user to ".$current_user;
+ SVK::Config->auth_providers(
+ sub {
+ [
+# SVN::Client::get_username_provider(),
+ SVN::Client::get_simple_prompt_provider( $class->can('_svkui_auth'), 0 ),
+ ];
+ }
+ );
+}
+
+sub _svkui_auth {
+#SVK::Config->_simple_prompt(
+ my ($cred, $realm, $default_username, $may_save, $pool) = @_;
+ warn "Setting user/pass to ".$current_user;
+ $cred->username($current_user);
+ $cred->password($current_pass);
+ $cred->may_save(0);
+ return $SVN::_Core::SVN_NO_ERROR;
+}
+#);
+
1;
Modified: SVKUI/trunk/lib/SVKUI/Model/Project.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Model/Project.pm (original)
+++ SVKUI/trunk/lib/SVKUI/Model/Project.pm Mon Sep 3 18:51:53 2007
@@ -68,6 +68,31 @@
# Your model-specific methods go here.
+#our $current_user;
+#our $current_pass;
+#sub setup_auth {
+# my $self = shift;
+# $current_user = $self->authuser;
+# $current_pass = $self->authpass;
+# warn "Setting user to ".$current_user;
+# SVK::Config->auth_providers(
+# sub {
+# [
+# SVN::Client::get_simple_prompt_provider( \&_svkui_auth, 0 ),
+# ];
+# }
+# );
+#}
+
+#sub _svkui_auth {
+# my ($cred, $realm, $default_username, $may_save, $pool) = @_;
+# warn "Setting user/pass to ".$current_user;
+# $cred->username($current_user);
+# $cred->password($current_pass);
+# $cred->may_save(0);
+# return $SVN::_Core::SVN_NO_ERROR;
+#}
+
sub update_revision {
my $self = shift;
my $rev = shift;
@@ -86,6 +111,17 @@
my $self = shift;
my $path = shift;
return 1 unless defined($self->url);
+ #SVKUI->setup_auth($au,$pa) if defined($pa);
+ local *SVK::Config::_simple_prompt = sub {
+ my ($cred, $realm, $default_username, $may_save, $pool) = @_;
+ my $current_user = $self->authuser;
+ my $current_pass = $self->authpass;
+ warn "Setting user/pass to ".$current_user;
+ $cred->username($current_user);
+ $cred->password($current_pass);
+ $cred->may_save(0);
+ return $SVN::_Core::SVN_NO_ERROR;
+ };
warn 'svk mirror '.$path.' '.$self->url;
if (SVKUI->_svkcmd('mirror', $path, $self->url)) {
warn 'svk mirror '.$path.' '.$self->url.' fail!';
@@ -145,6 +181,7 @@
if ($id) {
if ($self->try_mirror('//mirror/'.$self->name)) { # if mirror failed
$self->delete(); # if not success, then delete
+ warn "failed => ".$id;
($id , $msg) = (0, _('Mirror failed'));
}
}
More information about the Bps-public-commit
mailing list