Page MenuHomestyx hydra

No OneTemporary

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
@@ -1,54 +1,56 @@
create table phabricator_repository.repository_commitdata (
id int unsigned not null auto_increment primary key,
commitID int unsigned not null,
authorName varchar(255) not null,
commitMessage longblob not null,
unique key (commitID),
key (authorName)
);
ALTER TABLE phabricator_worker.worker_task drop priority;
ALTER TABLE phabricator_worker.worker_task drop key leaseOwner;
ALTER TABLE phabricator_worker.worker_task drop key (leaseOwner(16));
create table phabricator_repository.repository_path (
id int unsigned not null auto_increment primary key,
path varchar(512) binary not null,
unique key (path)
);
create table phabricator_repository.repository_pathchange (
repositoryID int unsigned NOT NULL,
pathID int unsigned NOT NULL,
commitID int unsigned NOT NULL,
targetPathID int unsigned,
targetCommitID int unsigned,
changeType int unsigned NOT NULL,
fileType int unsigned NOT NULL,
isDirect bool NOT NULL,
commitSequence int unsigned NOT NULL,
primary key (commitID, pathID),
key (repositoryID, pathID, commitSequence)
);
create table phabricator_repository.repository_filesystem (
repositoryID int unsigned not null,
parentID int unsigned not null,
svnCommit int unsigned not null,
pathID int unsigned not null,
existed bool not null,
fileType int unsigned not null,
primary key (repositoryID, parentID, svnCommit, pathID)
);
alter table repository_filesystem add key (repositoryID, svnCommit);
truncate phabricator_repository.repository_commit;
alter table phabricator_repository.repository_commit
change repositoryPHID repositoryID int unsigned not null;
alter table phabricator_repository.repository_commit drop key repositoryPHID;
alter table phabricator_repository.repository_commit add unique key
(repositoryID, commitIdentifier(16));
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
@@ -1,134 +1,134 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class DiffusionSvnBrowseQuery extends DiffusionBrowseQuery {
protected function executeQuery() {
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
$path = $drequest->getPath();
$commit = $drequest->getCommit();
$path_normal = '/'.trim($path, '/');
$conn_r = $repository->establishConnection('r');
$paths = queryfx_all(
$conn_r,
'SELECT id, path FROM %T WHERE path IN (%Ls)',
PhabricatorRepository::TABLE_PATH,
array($path_normal));
$paths = ipull($paths, 'id', 'path');
$path_id = idx($paths, $path_normal);
if (empty($path_id)) {
$this->reason = self::REASON_IS_NONEXISTENT;
return array();
}
if ($commit) {
$slice_clause = 'AND svnCommit <= '.(int)$commit;
} else {
$slice_clause = '';
}
$index = queryfx_all(
$conn_r,
'SELECT pathID, max(svnCommit) maxCommit FROM %T WHERE
repositoryID = %d AND parentID = %d
%Q GROUP BY pathID',
PhabricatorRepository::TABLE_FILESYSTEM,
$repository->getID(),
$path_id,
$slice_clause);
if (!$index) {
- if ($this->path == '/') {
+ if ($path == '/') {
$this->reason = self::REASON_IS_EMPTY;
} else {
$reasons = queryfx_all(
$conn_r,
'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d
%Q ORDER BY svnCommit DESC LIMIT 2',
PhabricatorRepository::TABLE_FILESYSTEM,
$repository->getID(),
$path_id,
$slice_clause);
$reason = reset($reasons);
if (!$reason) {
$this->reason = self::REASON_IS_NONEXISTENT;
} else {
$file_type = $reason['fileType'];
if (empty($reason['existed'])) {
$this->reason = self::REASON_IS_DELETED;
$this->deletedAtCommit = $reason['svnCommit'];
if (!empty($reasons[1])) {
$this->existedAtCommit = $reasons[1]['svnCommit'];
}
} else if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
$this->reason = self::REASON_IS_EMPTY;
} else {
$this->reason = self::REASON_IS_FILE;
}
}
}
return array();
}
$sql = array();
foreach ($index as $row) {
$sql[] = '('.(int)$row['pathID'].', '.(int)$row['maxCommit'].')';
}
$browse = queryfx_all(
$conn_r,
'SELECT *, p.path pathName
FROM %T f JOIN %T p ON f.pathID = p.id
WHERE repositoryID = %d
AND parentID = %d
AND existed = 1
AND (pathID, svnCommit) in (%Q)
ORDER BY pathName',
PhabricatorRepository::TABLE_FILESYSTEM,
PhabricatorRepository::TABLE_PATH,
$repository->getID(),
$path_id,
implode(', ', $sql));
$results = array();
foreach ($browse as $file) {
$file_path = $file['pathName'];
$file_path = ltrim(substr($file_path, strlen($path_normal)), '/');
$result = new DiffusionRepositoryPath();
$result->setPath($file_path);
// $result->setHash($hash);
$result->setFileType($file['fileType']);
// $result->setFileSize($size);
$results[] = $result;
}
return $results;
}
}
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
@@ -1,42 +1,58 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class DiffusionSvnFileContentQuery extends DiffusionFileContentQuery {
protected function executeQuery() {
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
$path = $drequest->getPath();
$commit = $drequest->getCommit();
$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);
return $file_content;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Aug 15, 5:23 AM (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
202395
Default Alt Text
(8 KB)

Event Timeline