Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15399898
D16436.id39527.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D16436.id39527.diff
View Options
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -73,6 +73,38 @@
$commit_data = $commit->getCommitData();
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
$error_panel = null;
+
+ $hard_limit = 1000;
+
+ if ($commit->isImported()) {
+ $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
+ $drequest);
+ $change_query->setLimit($hard_limit + 1);
+ $changes = $change_query->loadChanges();
+ } else {
+ $changes = array();
+ }
+
+ $was_limited = (count($changes) > $hard_limit);
+ if ($was_limited) {
+ $changes = array_slice($changes, 0, $hard_limit);
+ }
+
+ $count = count($changes);
+
+ $is_unreadable = false;
+ $hint = null;
+ if (!$count || $commit->isUnreachable()) {
+ $hint = id(new DiffusionCommitHintQuery())
+ ->setViewer($viewer)
+ ->withRepositoryPHIDs(array($repository->getPHID()))
+ ->withOldCommitIdentifiers(array($commit->getCommitIdentifier()))
+ ->executeOne();
+ if ($hint) {
+ $is_unreadable = $hint->isUnreadable();
+ }
+ }
+
if ($is_foreign) {
$subpath = $commit_data->getCommitDetail('svn-subpath');
@@ -130,9 +162,41 @@
$message));
if ($commit->isUnreachable()) {
- $this->commitErrors[] = pht(
- 'This commit has been deleted in the repository: it is no longer '.
- 'reachable from any branch, tag, or ref.');
+ $did_rewrite = false;
+ if ($hint) {
+ if ($hint->isRewritten()) {
+ $rewritten = id(new DiffusionCommitQuery())
+ ->setViewer($viewer)
+ ->withRepository($repository)
+ ->withIdentifiers(array($hint->getNewCommitIdentifier()))
+ ->executeOne();
+ if ($rewritten) {
+ $did_rewrite = true;
+ $rewritten_uri = $rewritten->getURI();
+ $rewritten_name = $rewritten->getLocalName();
+
+ $rewritten_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => $rewritten_uri,
+ ),
+ $rewritten_name);
+
+ $this->commitErrors[] = pht(
+ 'This commit was rewritten after it was published, which '.
+ 'changed the commit hash. This old version of the commit is '.
+ 'no longer reachable from any branch, tag or ref. The new '.
+ 'version of this commit is %s.',
+ $rewritten_link);
+ }
+ }
+ }
+
+ if (!$did_rewrite) {
+ $this->commitErrors[] = pht(
+ 'This commit has been deleted in the repository: it is no longer '.
+ 'reachable from any branch, tag, or ref.');
+ }
}
if ($this->getCommitErrors()) {
@@ -143,42 +207,12 @@
}
$timeline = $this->buildComments($commit);
- $hard_limit = 1000;
-
- if ($commit->isImported()) {
- $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
- $drequest);
- $change_query->setLimit($hard_limit + 1);
- $changes = $change_query->loadChanges();
- } else {
- $changes = array();
- }
-
- $was_limited = (count($changes) > $hard_limit);
- if ($was_limited) {
- $changes = array_slice($changes, 0, $hard_limit);
- }
-
$merge_table = $this->buildMergesTable($commit);
$highlighted_audits = $commit->getAuthorityAudits(
$viewer,
$this->auditAuthorityPHIDs);
- $count = count($changes);
-
- $is_unreadable = false;
- if (!$count) {
- $hint = id(new DiffusionCommitHintQuery())
- ->setViewer($viewer)
- ->withRepositoryPHIDs(array($repository->getPHID()))
- ->withOldCommitIdentifiers(array($commit->getCommitIdentifier()))
- ->executeOne();
- if ($hint) {
- $is_unreadable = $hint->isUnreadable();
- }
- }
-
$show_changesets = false;
$info_panel = null;
$change_list = null;
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommitHint.php b/src/applications/repository/storage/PhabricatorRepositoryCommitHint.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommitHint.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommitHint.php
@@ -105,6 +105,10 @@
return ($this->getHintType() == self::HINT_UNREADABLE);
}
+ public function isRewritten() {
+ return ($this->getHintType() == self::HINT_REWRITTEN);
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 8:21 AM (4 d, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7232452
Default Alt Text
D16436.id39527.diff (4 KB)
Attached To
Mode
D16436: When a commit has a "rewritten" hint, show it in the UI instead of the generic "deleted" message
Attached
Detach File
Event Timeline
Log In to Comment