1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Display link in Revision ToC for copied or moved files

Summary:
They are present in the document so there is not reason to omit the links to
them.
They sometimes contains changed lines so the link could be actualy useful.

Test Plan: Display ToC of revision with moved and copied files.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, nh

Differential Revision: https://secure.phabricator.com/D1412
This commit is contained in:
vrana 2012-01-15 22:43:54 -08:00
parent c7997e0a7c
commit f109342a7a

View file

@ -64,29 +64,6 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$type = $changeset->getChangeType(); $type = $changeset->getChangeType();
$ftype = $changeset->getFileType(); $ftype = $changeset->getFileType();
if (DifferentialChangeType::isOldLocationChangeType($type)) {
$link = phutil_escape_html($display_file);
$away = $changeset->getAwayPaths();
if (count($away) > 1) {
$meta = array();
if ($type == DifferentialChangeType::TYPE_MULTICOPY) {
$meta[] = 'Deleted after being copied to multiple locations:';
} else {
$meta[] = 'Copied to multiple locations:';
}
foreach ($away as $path) {
$meta[] = phutil_escape_html($path);
}
$meta = implode('<br />', $meta);
} else {
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
$meta = 'Moved to '.phutil_escape_html(reset($away));
} else {
$meta = 'Copied to '.phutil_escape_html(reset($away));
}
}
} else {
if ($this->standaloneViewLink) { if ($this->standaloneViewLink) {
$id = $changeset->getID(); $id = $changeset->getID();
if ($id) { if ($id) {
@ -120,14 +97,33 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
phutil_escape_html($display_file)); phutil_escape_html($display_file));
} }
if ($type == DifferentialChangeType::TYPE_MOVE_HERE) { if (DifferentialChangeType::isOldLocationChangeType($type)) {
$away = $changeset->getAwayPaths();
if (count($away) > 1) {
$meta = array();
if ($type == DifferentialChangeType::TYPE_MULTICOPY) {
$meta[] = 'Deleted after being copied to multiple locations:';
} else {
$meta[] = 'Copied to multiple locations:';
}
foreach ($away as $path) {
$meta[] = phutil_escape_html($path);
}
$meta = implode('<br />', $meta);
} else {
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
$meta = 'Moved to '.phutil_escape_html(reset($away));
} else {
$meta = 'Copied to '.phutil_escape_html(reset($away));
}
}
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
$meta = 'Moved from '.phutil_escape_html($changeset->getOldFile()); $meta = 'Moved from '.phutil_escape_html($changeset->getOldFile());
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) { } else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
$meta = 'Copied from '.phutil_escape_html($changeset->getOldFile()); $meta = 'Copied from '.phutil_escape_html($changeset->getOldFile());
} else { } else {
$meta = null; $meta = null;
} }
}
$line_count = $changeset->getAffectedLineCount(); $line_count = $changeset->getAffectedLineCount();
if ($line_count == 0) { if ($line_count == 0) {