Page MenuHomePhorge

D25738.1734637817.diff
No OneTemporary

D25738.1734637817.diff

diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -652,6 +652,15 @@
$rename_query->setOldCommit($grandparent);
$rename_query->setViewer($request->getUser());
$old_filename = $rename_query->loadOldFilename();
+ if (!$old_filename) {
+ $rename_notice = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setTitle(pht('Unable to Continue'))
+ ->appendChild(
+ pht(
+ 'Unable to continue tracing the history of this file because '.
+ 'this commit was not imported correctly.'));
+ }
$was_created = $rename_query->getWasCreated();
}
}
diff --git a/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php b/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php
--- a/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php
+++ b/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php
@@ -30,15 +30,20 @@
return $this->oldCommit;
}
+ /**
+ * @return string|null Path to previous filename
+ */
public function loadOldFilename() {
$drequest = $this->request;
$repository_id = $drequest->getRepository()->getID();
$conn_r = id(new PhabricatorRepository())->establishConnection('r');
$commit_id = $this->loadCommitId($this->oldCommit);
- $old_commit_sequence = $this->loadCommitSequence($commit_id);
-
$path = '/'.$drequest->getPath();
+ $old_commit_sequence = $this->loadCommitSequence($commit_id);
+ if ($old_commit_sequence === null) {
+ return null;
+ }
$commit_id = $this->loadCommitId($drequest->getCommit());
do {
@@ -86,6 +91,9 @@
return $commit->getID();
}
+ /**
+ * @return string|null commitSequence ID
+ */
private function loadCommitSequence($commit_id) {
$conn_r = id(new PhabricatorRepository())->establishConnection('r');
$path_change = queryfx_one(
@@ -97,6 +105,9 @@
PhabricatorRepository::TABLE_PATHCHANGE,
$this->request->getRepository()->getID(),
$commit_id);
+ if ($path_change === null) {
+ return null;
+ }
return reset($path_change);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 19:50 (3 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015457
Default Alt Text
D25738.1734637817.diff (2 KB)

Event Timeline