From 13a48a79d733156120e520c1706746744f2440d4 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 26 Apr 2012 00:18:42 -0700 Subject: [PATCH] Highlight copied/moved lines in Differential Summary: The color used for this feature is pretty important and I am bad with colors. Test Plan: View diff created by D2320 with some copied lines and one line changed: {F10604, size=full} Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2321 --- src/__celerity_resource_map__.php | 39 +++++++++++-------- .../changeset/DifferentialChangesetParser.php | 15 +++++++ .../differential/changeset-view.css | 4 ++ 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index dd5186386a..a1e4230482 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -14,6 +14,13 @@ celerity_register_resource_map(array( 'disk' => '/rsrc/image/apps.png', 'type' => 'png', ), + '/rsrc/image/avatar.png' => + array( + 'hash' => '1c5f255071537f05406adee86717ff27', + 'uri' => '/res/1c5f2550/rsrc/image/avatar.png', + 'disk' => '/rsrc/image/avatar.png', + 'type' => 'png', + ), '/rsrc/image/credit_cards.png' => array( 'hash' => '681448de424ea159b6ea68af04c046ae', @@ -524,7 +531,7 @@ celerity_register_resource_map(array( ), 'differential-changeset-view-css' => array( - 'uri' => '/res/00dcf176/rsrc/css/application/differential/changeset-view.css', + 'uri' => '/res/5c7db62d/rsrc/css/application/differential/changeset-view.css', 'type' => 'css', 'requires' => array( @@ -2484,7 +2491,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/0c96375e/core.pkg.js', 'type' => 'js', ), - 'a841d960' => + '1715d060' => array( 'name' => 'differential.pkg.css', 'symbols' => @@ -2503,7 +2510,7 @@ celerity_register_resource_map(array( 11 => 'differential-local-commits-view-css', 12 => 'inline-comment-summary-css', ), - 'uri' => '/res/pkg/a841d960/differential.pkg.css', + 'uri' => '/res/pkg/1715d060/differential.pkg.css', 'type' => 'css', ), 70509835 => @@ -2626,7 +2633,7 @@ celerity_register_resource_map(array( 'aphront-dialog-view-css' => '9c4e265b', 'aphront-error-view-css' => '9c4e265b', 'aphront-form-view-css' => '9c4e265b', - 'aphront-headsup-action-list-view-css' => 'a841d960', + 'aphront-headsup-action-list-view-css' => '1715d060', 'aphront-headsup-view-css' => '9c4e265b', 'aphront-list-filter-view-css' => '9c4e265b', 'aphront-pager-view-css' => '9c4e265b', @@ -2636,19 +2643,19 @@ celerity_register_resource_map(array( 'aphront-tokenizer-control-css' => '9c4e265b', 'aphront-tooltip-css' => '9c4e265b', 'aphront-typeahead-control-css' => '9c4e265b', - 'differential-changeset-view-css' => 'a841d960', - 'differential-core-view-css' => 'a841d960', + 'differential-changeset-view-css' => '1715d060', + 'differential-core-view-css' => '1715d060', 'differential-inline-comment-editor' => '70509835', - 'differential-local-commits-view-css' => 'a841d960', - 'differential-revision-add-comment-css' => 'a841d960', - 'differential-revision-comment-css' => 'a841d960', - 'differential-revision-comment-list-css' => 'a841d960', - 'differential-revision-detail-css' => 'a841d960', - 'differential-revision-history-css' => 'a841d960', - 'differential-table-of-contents-css' => 'a841d960', + 'differential-local-commits-view-css' => '1715d060', + 'differential-revision-add-comment-css' => '1715d060', + 'differential-revision-comment-css' => '1715d060', + 'differential-revision-comment-list-css' => '1715d060', + 'differential-revision-detail-css' => '1715d060', + 'differential-revision-history-css' => '1715d060', + 'differential-table-of-contents-css' => '1715d060', 'diffusion-commit-view-css' => 'c8ce2d88', 'diffusion-icons-css' => 'c8ce2d88', - 'inline-comment-summary-css' => 'a841d960', + 'inline-comment-summary-css' => '1715d060', 'javelin-behavior' => '8a5de8a3', 'javelin-behavior-aphront-basic-tokenizer' => '97f65640', 'javelin-behavior-aphront-drag-and-drop' => '70509835', @@ -2702,7 +2709,7 @@ celerity_register_resource_map(array( 'maniphest-task-summary-css' => '7839ae2d', 'maniphest-transaction-detail-css' => '7839ae2d', 'phabricator-app-buttons-css' => '9c4e265b', - 'phabricator-content-source-view-css' => 'a841d960', + 'phabricator-content-source-view-css' => '1715d060', 'phabricator-core-buttons-css' => '9c4e265b', 'phabricator-core-css' => '9c4e265b', 'phabricator-directory-css' => '9c4e265b', @@ -2713,7 +2720,7 @@ celerity_register_resource_map(array( 'phabricator-keyboard-shortcut' => '0c96375e', 'phabricator-keyboard-shortcut-manager' => '0c96375e', 'phabricator-menu-item' => '0c96375e', - 'phabricator-object-selector-css' => 'a841d960', + 'phabricator-object-selector-css' => '1715d060', 'phabricator-paste-file-upload' => '0c96375e', 'phabricator-prefab' => '0c96375e', 'phabricator-project-tag-css' => '7839ae2d', diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php index f8b0e8f7c4..e46fb6f049 100644 --- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php @@ -1277,6 +1277,8 @@ final class DifferentialChangesetParser { ? 'N' : 'O'; + $copy_lines = idx($this->changeset->getMetadata(), 'copy:lines', array()); + for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { if (empty($mask[$ii])) { // If we aren't going to show this line, we've just entered a gap. @@ -1407,6 +1409,19 @@ final class DifferentialChangesetParser { if ($this->new[$ii]['type'] == '\\') { $n_text = $this->new[$ii]['text']; $n_attr = ' class="comment"'; + } else if (isset($copy_lines[$n_num])) { + list($orig_file, $orig_line) = $copy_lines[$n_num]; + if ($orig_file == '') { + $title = "line {$orig_line}"; + } else { + $title = + basename($orig_file). + ":{$orig_line} in dir ". + dirname('/'.$orig_file); + } + $n_attr = + ' class="new new-copy"'. + ' title="Copied from '.phutil_escape_html($title).'"'; } else if (empty($this->old[$ii])) { $n_attr = ' class="new new-full"'; } else { diff --git a/webroot/rsrc/css/application/differential/changeset-view.css b/webroot/rsrc/css/application/differential/changeset-view.css index 2b2192a7df..d20c98ab56 100644 --- a/webroot/rsrc/css/application/differential/changeset-view.css +++ b/webroot/rsrc/css/application/differential/changeset-view.css @@ -80,6 +80,10 @@ background: #ffaaaa; } +.differential-diff td.new-copy { + background: #ffffaa; +} + .differential-diff td.new-full, .differential-diff td.new span.bright { background: #aaffaa;