Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistSubversionAPI.php
Context not available. | |||||
foreach ($files as $path => $mask) { | foreach ($files as $path => $mask) { | ||||
foreach ($externals as $external) { | foreach ($externals as $external) { | ||||
if (!strncmp($path.'/', $external.'/', strlen($external) + 1)) { | if (!strncmp($path.'/', $external.'/', @strlen($external) + 1)) { | ||||
$files[$path] |= self::FLAG_EXTERNALS; | $files[$path] |= self::FLAG_EXTERNALS; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
public function getBranchName() { | public function getBranchName() { | ||||
$info = $this->getSVNInfo('/'); | $info = $this->getSVNInfo('/'); | ||||
$repo_root = idx($info, 'Repository Root'); | $repo_root = idx($info, 'Repository Root'); | ||||
$repo_root_length = strlen($repo_root); | $repo_root_length = @strlen($repo_root); | ||||
$url = idx($info, 'URL'); | $url = idx($info, 'URL'); | ||||
if (substr($url, 0, $repo_root_length) == $repo_root) { | if (@substr($url, 0, $repo_root_length) == $repo_root) { | ||||
return substr($url, $repo_root_length); | return @substr($url, $repo_root_length); | ||||
} | } | ||||
return 'svn'; | return 'svn'; | ||||
} | } | ||||
Context not available. | |||||
$result = array(); | $result = array(); | ||||
foreach ($patterns as $pattern) { | foreach ($patterns as $pattern) { | ||||
$matches = null; | $matches = null; | ||||
if (preg_match($pattern, $stdout, $matches)) { | if (@preg_match($pattern, $stdout, $matches)) { | ||||
$result[$matches[1]] = $matches[2]; | $result[$matches[1]] = $matches[2]; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
// files. We just fix this inline since it's pretty unambiguous. | // files. We just fix this inline since it's pretty unambiguous. | ||||
// TODO: Move this to configuration? | // TODO: Move this to configuration? | ||||
$matches = null; | $matches = null; | ||||
if (preg_match('/\.(gif|png|jpe?g|swf|pdf|ico)$/i', $path, $matches)) { | if (@preg_match('/\.(gif|png|jpe?g|swf|pdf|ico)$/i', $path, $matches)) { | ||||
// Check if the file is deleted first; SVN will complain if we try to | // Check if the file is deleted first; SVN will complain if we try to | ||||
// get properties of a deleted file. | // get properties of a deleted file. | ||||
if ($status & parent::FLAG_DELETED) { | if ($status & parent::FLAG_DELETED) { | ||||
Context not available. | |||||
} | } | ||||
$data = Filesystem::readFile($full_path); | $data = Filesystem::readFile($full_path); | ||||
$lines = explode("\n", $data); | $lines = @explode("\n", $data); | ||||
$len = count($lines); | $len = count($lines); | ||||
foreach ($lines as $key => $line) { | foreach ($lines as $key => $line) { | ||||
$lines[$key] = ' '.$line; | $lines[$key] = ' '.$line; | ||||
Context not available. | |||||
public function getChangedFiles($since_commit) { | public function getChangedFiles($since_commit) { | ||||
$url = ''; | $url = ''; | ||||
$match = null; | $match = null; | ||||
if (preg_match('/(.*)@(.*)/', $since_commit, $match)) { | if (@preg_match('/(.*)@(.*)/', $since_commit, $match)) { | ||||
list(, $url, $since_commit) = $match; | list(, $url, $since_commit) = $match; | ||||
} | } | ||||
// TODO: Handle paths with newlines. | // TODO: Handle paths with newlines. | ||||
Context not available. | |||||
public function filterFiles($path) { | public function filterFiles($path) { | ||||
// NOTE: SVN uses '/' also on Windows. | // NOTE: SVN uses '/' also on Windows. | ||||
if ($path == '' || substr($path, -1) == '/') { | if ($path == '' || @substr($path, -1) == '/') { | ||||
return null; | return null; | ||||
} | } | ||||
return $path; | return $path; | ||||
Context not available. | |||||
list($stdout) = $this->execxLocal('blame %s', $path); | list($stdout) = $this->execxLocal('blame %s', $path); | ||||
$stdout = trim($stdout); | $stdout = trim($stdout); | ||||
if (!strlen($stdout)) { | if (!@strlen($stdout)) { | ||||
// Empty file. | // Empty file. | ||||
return $blame; | return $blame; | ||||
} | } | ||||
foreach (explode("\n", $stdout) as $line) { | foreach (@explode("\n", $stdout) as $line) { | ||||
$m = array(); | $m = array(); | ||||
if (!preg_match('/^\s*(\d+)\s+(\S+)/', $line, $m)) { | if (!@preg_match('/^\s*(\d+)\s+(\S+)/', $line, $m)) { | ||||
throw new Exception(pht("Bad blame? `%s'", $line)); | throw new Exception(pht("Bad blame? `%s'", $line)); | ||||
} | } | ||||
$revision = $m[1]; | $revision = $m[1]; | ||||
Context not available. | |||||
// where ".@" means "fail with an error" instead of ". at the working copy | // where ".@" means "fail with an error" instead of ". at the working copy | ||||
// revision", so avoid escaping "." into ".@". | // revision", so avoid escaping "." into ".@". | ||||
if (strpos($file, '@') !== false) { | if (@strpos($file, '@') !== false) { | ||||
$file = $file.'@'; | $file = $file.'@'; | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0