* refactored with Composer\Util\Svn::doAuthDance()

main
till 12 years ago
parent 0d6297f235
commit 059bde1adb

@ -87,32 +87,28 @@ class SvnDriver extends VcsDriver
$output
);
// this could be any failure
if ($status > 0 && $this->io->isInteractive()) {
// the error is not auth-related
if (strpos($output, 'authorization failed:') === false) {
return $output;
}
if ($status == 0) {
return $output;
}
// no authorization has been detected so far
if (!$this->useAuth) {
$this->io->write("The Subversion server ({$this->baseUrl}) requested credentials:");
// this could be any failure, since SVN exits with 1 always
if (!$this->io->isInteractive()) {
return $output;
}
$this->svnUsername = $this->io->ask("Username");
$this->svnPassword = $this->io->askAndHideAnswer("Password");
$this->useAuth = true;
// the error is not auth-related
if (strpos($output, 'authorization failed:') === false) {
return $output;
}
$pleaseCache = $this->io->askConfirmation("Should Subversion cache these credentials?", false);
if ($pleaseCache === true) {
$this->useCache = true;
}
// no authorization has been detected so far
if (!$this->useAuth) {
$this->useAuth = $this->util->doAuthDance()->hasAuth();
// restart the process
$output = $this->execute($command, $url);
} else {
$this->io->write("Authorization failed: {$svnCommand}");
}
// restart the process
$output = $this->execute($command, $url);
} else {
$this->io->write("Authorization failed: {$svnCommand}");
}
return $output;
}

Loading…
Cancel
Save