/** * @param WorkingCopy $workingCopy * @throws Exception */ public static function purgeIgnoredAndUnversioned($workingCopy) { // Remove unversioned and ignored files/folders self::log("- Removing ignored and unversioned files and folders\n"); $cmd = Config::get('svn.bin') . " status --no-ignore " . "--username {$workingCopy->account->username} " . "--password {$workingCopy->account->password} " . "--non-interactive --trust-server-cert --no-auth-cache {$workingCopy->dir->getPath()} 2>&1"; exec($cmd, $output, $err); if ($err !== 0) { throw new Exception("SVN deletion of ignored and unversioned files failed:\n\t" . implode("\n\t", $output) . "\n"); } foreach ($output as $lineNumber => $line) { if (preg_match('/^(I|\\?)\\s{7}/', $line) === 1) { $file = mb_substr($line, 8); self::log("Deleting {$file}\n"); if (file_exists($file)) { if (is_dir($file)) { FileSystemTask::rrmdir($file); } else { unlink($file); } } } } self::log("\n"); }