} /** * Look for SVN repositories to import into USVN and finally perform the action */ $svnImport = new USVN_ImportSVNRepositories(); foreach ($paths as $path) { $tmp = $svnImport->lookAfterSVNRepositoriesToImport($path, $options); if (count($tmp)) { $repos = array_merge($repos, $tmp); } else { if ($options['verbose']) { print "No SVN repository here: {$path}\n"; } } } //if we don't have any repository to import then die if (!count($repos)) { print $usage; exit(1); } /** * Now we can import (if there is no option 'noimport') our SVN Repositories into USVN */ $svnImport->addSVNRepositoriesToImport($repos, $options); if (!$options['noimport']) { $results = $svnImport->importSVNRepositories(); print "SVN repositories imported:\n" . implode("\n", $repos); } else { print "SVN repositories ready to import:\n" . implode("\n", $repos); } exit(0);
public function testImportSVNRepositoriesOk() { try { $table = new USVN_Db_Table_Users(); $obj = $table->fetchNew(); $obj->setFromArray(array('users_login' => 'user_test', 'users_password' => 'password', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**')); $obj->save(); } catch (USVN_Exception $e) { print $e->getMessage() . "\n"; $this->fail(); } $path = 'tests/tmp/svn/test/'; mkdir($path); USVN_SVNUtils::createSvn($path . 'test'); USVN_SVNUtils::createSvn($path . 'test2'); mkdir($path . 'test3'); USVN_SVNUtils::createSvn($path . 'test3/test3'); $options = array('recursive' => true, 'login' => 'user_test'); $imp = new USVN_ImportSVNRepositories(); $results = $imp->lookAfterSVNRepositoriesToImport($path, $options); if (count($results) != 3) { $this->fail(); } $imp->addSVNRepositoriesToImport($results, $options); try { $imp->importSVNRepositories(); } catch (USVN_Exception $e) { print $e->getMessage() . "\n"; $this->fail(); } USVN_DirectoryUtils::removeDirectory($path); }