1
0
Fork 0

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

pull/410/head
till 2012-03-22 18:40:49 +01:00
parent 0d6297f235
commit 059bde1adb
1 changed files with 18 additions and 22 deletions

View File

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