diff --git a/resources/sql/patches/006.repository.sql b/resources/sql/patches/006.repository.sql index 29ce4aa76e..4f1e83f948 100644 --- a/resources/sql/patches/006.repository.sql +++ b/resources/sql/patches/006.repository.sql @@ -52,3 +52,5 @@ alter table phabricator_repository.repository_commit add unique key alter table phabricator_repository.repository_commit add key (repositoryID, epoch); +alter table phabricator_repository.repository_filesystem + add key (repositoryID, pathID, svnCommit); \ No newline at end of file diff --git a/src/applications/diffusion/query/browse/svn/DiffusionSvnBrowseQuery.php b/src/applications/diffusion/query/browse/svn/DiffusionSvnBrowseQuery.php index 59ed975b26..7710362646 100644 --- a/src/applications/diffusion/query/browse/svn/DiffusionSvnBrowseQuery.php +++ b/src/applications/diffusion/query/browse/svn/DiffusionSvnBrowseQuery.php @@ -59,7 +59,7 @@ final class DiffusionSvnBrowseQuery extends DiffusionBrowseQuery { $slice_clause); if (!$index) { - if ($this->path == '/') { + if ($path == '/') { $this->reason = self::REASON_IS_EMPTY; } else { $reasons = queryfx_all( diff --git a/src/applications/diffusion/query/filecontent/svn/DiffusionSvnFileContentQuery.php b/src/applications/diffusion/query/filecontent/svn/DiffusionSvnFileContentQuery.php index 6105b1498e..dc3deece81 100644 --- a/src/applications/diffusion/query/filecontent/svn/DiffusionSvnFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/svn/DiffusionSvnFileContentQuery.php @@ -27,11 +27,27 @@ final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery { $remote_uri = $repository->getDetail('remote-uri'); - list($corpus) = execx( - 'svn --non-interactive cat %s%s@%s', - $remote_uri, - $path, - $commit); + try { + list($corpus) = execx( + 'svn --non-interactive cat %s%s@%s', + $remote_uri, + $path, + $commit); + } catch (CommandException $ex) { + $stderr = $ex->getStdErr(); + if (preg_match('/path not found$/', trim($stderr))) { + // TODO: Improve user experience for this. One way to end up here + // is to have the parser behind and look at a file which was recently + // nuked; Diffusion will think it still exists and try to grab content + // at HEAD. + throw new Exception( + "Failed to retrieve file content from Subversion. The file may ". + "have been recently deleted, or the Diffusion cache may be out of ". + "date."); + } else { + throw $ex; + } + } $file_content = new DiffusionFileContent(); $file_content->setCorpus($corpus);