mirror of
https://we.phorge.it/source/phorge.git
synced 2024-09-21 01:38:48 +02:00
Condense renames in Differential ToC
Summary: It's currently quite confusing. Test Plan: lang=diff diff --git a/bin/config b/bin/x similarity index 100% rename from bin/config rename to bin/x diff --git a/bin/aphlict b/bin/y/aphlict similarity index 100% rename from bin/aphlict rename to bin/y/aphlict diff --git a/bin/diviner b/scripts/z similarity index 100% rename from bin/diviner rename to scripts/z Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, AnhNhan Differential Revision: https://secure.phabricator.com/D5708
This commit is contained in:
parent
ef3d1150fc
commit
ed02823eaf
1 changed files with 49 additions and 7 deletions
|
@ -82,8 +82,9 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
||||||
$type = $changeset->getChangeType();
|
$type = $changeset->getChangeType();
|
||||||
$ftype = $changeset->getFileType();
|
$ftype = $changeset->getFileType();
|
||||||
$ref = idx($this->references, $id);
|
$ref = idx($this->references, $id);
|
||||||
$link = $this->renderChangesetLink($changeset, $ref);
|
$display_file = $changeset->getDisplayFilename();
|
||||||
|
|
||||||
|
$meta = null;
|
||||||
if (DifferentialChangeType::isOldLocationChangeType($type)) {
|
if (DifferentialChangeType::isOldLocationChangeType($type)) {
|
||||||
$away = $changeset->getAwayPaths();
|
$away = $changeset->getAwayPaths();
|
||||||
if (count($away) > 1) {
|
if (count($away) > 1) {
|
||||||
|
@ -99,19 +100,26 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
||||||
$meta = phutil_implode_html(phutil_tag('br'), $meta);
|
$meta = phutil_implode_html(phutil_tag('br'), $meta);
|
||||||
} else {
|
} else {
|
||||||
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
|
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
|
||||||
$meta = pht('Moved to %s', reset($away));
|
$display_file = $this->renderRename(
|
||||||
|
$display_file,
|
||||||
|
reset($away),
|
||||||
|
"\xE2\x86\x92");
|
||||||
} else {
|
} else {
|
||||||
$meta = pht('Copied to %s', reset($away));
|
$meta = pht('Copied to %s', reset($away));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
|
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
|
||||||
$meta = pht('Moved from %s', $changeset->getOldFile());
|
$old_file = $changeset->getOldFile();
|
||||||
|
$display_file = $this->renderRename(
|
||||||
|
$display_file,
|
||||||
|
$old_file,
|
||||||
|
"\xE2\x86\x90");
|
||||||
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
|
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
|
||||||
$meta = pht('Copied from %s', $changeset->getOldFile());
|
$meta = pht('Copied from %s', $changeset->getOldFile());
|
||||||
} else {
|
|
||||||
$meta = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$link = $this->renderChangesetLink($changeset, $ref, $display_file);
|
||||||
|
|
||||||
$line_count = $changeset->getAffectedLineCount();
|
$line_count = $changeset->getAffectedLineCount();
|
||||||
if ($line_count == 0) {
|
if ($line_count == 0) {
|
||||||
$lines = null;
|
$lines = null;
|
||||||
|
@ -233,6 +241,38 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
||||||
$buttons);
|
$buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function renderRename($display_file, $other_file, $arrow) {
|
||||||
|
$old = explode('/', $display_file);
|
||||||
|
$new = explode('/', $other_file);
|
||||||
|
|
||||||
|
$start = count($old);
|
||||||
|
foreach ($old as $index => $part) {
|
||||||
|
if (!isset($new[$index]) || $part != $new[$index]) {
|
||||||
|
$start = $index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$end = count($old);
|
||||||
|
foreach (array_reverse($old) as $from_end => $part) {
|
||||||
|
$index = count($new) - $from_end - 1;
|
||||||
|
if (!isset($new[$index]) || $part != $new[$index]) {
|
||||||
|
$end = $from_end;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rename =
|
||||||
|
'{'.
|
||||||
|
implode('/', array_slice($old, $start, count($old) - $end - $start)).
|
||||||
|
' '.$arrow.' '.
|
||||||
|
implode('/', array_slice($new, $start, count($new) - $end - $start)).
|
||||||
|
'}';
|
||||||
|
|
||||||
|
array_splice($new, $start, count($new) - $end - $start, $rename);
|
||||||
|
return implode('/', $new);
|
||||||
|
}
|
||||||
|
|
||||||
private function renderCoverage(array $coverage, $file) {
|
private function renderCoverage(array $coverage, $file) {
|
||||||
$info = idx($coverage, $file);
|
$info = idx($coverage, $file);
|
||||||
if (!$info) {
|
if (!$info) {
|
||||||
|
@ -250,8 +290,10 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function renderChangesetLink(DifferentialChangeset $changeset, $ref) {
|
private function renderChangesetLink(
|
||||||
$display_file = $changeset->getDisplayFilename();
|
DifferentialChangeset $changeset,
|
||||||
|
$ref,
|
||||||
|
$display_file) {
|
||||||
|
|
||||||
return javelin_tag(
|
return javelin_tag(
|
||||||
'a',
|
'a',
|
||||||
|
|
Loading…
Reference in a new issue