Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class DifferentialChangesetHTMLRenderer
|
|
|
|
extends DifferentialChangesetRenderer {
|
|
|
|
|
2015-03-06 14:44:36 +01:00
|
|
|
public static function getHTMLRendererByKey($key) {
|
|
|
|
switch ($key) {
|
|
|
|
case '1up':
|
|
|
|
return new DifferentialChangesetOneUpRenderer();
|
|
|
|
case '2up':
|
|
|
|
default:
|
|
|
|
return new DifferentialChangesetTwoUpRenderer();
|
|
|
|
}
|
|
|
|
throw new Exception(pht('Unknown HTML renderer "%s"!', $key));
|
|
|
|
}
|
|
|
|
|
2015-03-05 23:01:52 +01:00
|
|
|
abstract protected function getRendererTableClass();
|
2015-03-06 14:44:36 +01:00
|
|
|
abstract public function getRowScaffoldForInline(
|
|
|
|
PHUIDiffInlineCommentView $view);
|
2015-03-05 23:01:52 +01:00
|
|
|
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
protected function renderChangeTypeHeader($force) {
|
|
|
|
$changeset = $this->getChangeset();
|
|
|
|
|
|
|
|
$change = $changeset->getChangeType();
|
|
|
|
$file = $changeset->getFileType();
|
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
$messages = array();
|
|
|
|
switch ($change) {
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_ADD:
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This file was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This image was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This directory was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This binary file was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This symlink was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This submodule was added.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_DELETE:
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This file was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This image was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This directory was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This binary file was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This symlink was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
2015-02-10 08:49:08 +01:00
|
|
|
$messages[] = pht('This submodule was deleted.');
|
2014-06-20 20:49:41 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_MOVE_HERE:
|
|
|
|
$from = phutil_tag('strong', array(), $changeset->getOldFile());
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
$messages[] = pht('This file was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht('This image was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht('This directory was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht('This binary file was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht('This symlink was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht('This submodule was moved from %s.', $from);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_COPY_HERE:
|
|
|
|
$from = phutil_tag('strong', array(), $changeset->getOldFile());
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
$messages[] = pht('This file was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht('This image was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht('This directory was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht('This binary file was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht('This symlink was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht('This submodule was copied from %s.', $from);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_MOVE_AWAY:
|
|
|
|
$paths = phutil_tag(
|
|
|
|
'strong',
|
|
|
|
array(),
|
|
|
|
implode(', ', $changeset->getAwayPaths()));
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
$messages[] = pht('This file was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht('This image was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht('This directory was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht('This binary file was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht('This symlink was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht('This submodule was moved to %s.', $paths);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_COPY_AWAY:
|
|
|
|
$paths = phutil_tag(
|
|
|
|
'strong',
|
|
|
|
array(),
|
|
|
|
implode(', ', $changeset->getAwayPaths()));
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
$messages[] = pht('This file was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht('This image was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht('This directory was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht('This binary file was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht('This symlink was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht('This submodule was copied to %s.', $paths);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
case DifferentialChangeType::TYPE_MULTICOPY:
|
|
|
|
$paths = phutil_tag(
|
|
|
|
'strong',
|
|
|
|
array(),
|
|
|
|
implode(', ', $changeset->getAwayPaths()));
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This image was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This directory was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This binary file was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This symlink was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This submodule was deleted after being copied to %s.',
|
|
|
|
$paths);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
default:
|
|
|
|
switch ($file) {
|
|
|
|
case DifferentialChangeType::FILE_TEXT:
|
|
|
|
// This is the default case, so we only render this header if
|
|
|
|
// forced to since it's not very useful.
|
|
|
|
if ($force) {
|
|
|
|
$messages[] = pht('This file was not modified.');
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht('This is an image.');
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht('This is a directory.');
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht('This is a binary file.');
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht('This is a symlink.');
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht('This is a submodule.');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-06-29 21:42:59 +02:00
|
|
|
// If this is a text file with at least one hunk, we may have converted
|
|
|
|
// the text encoding. In this case, show a note.
|
|
|
|
$show_encoding = ($file == DifferentialChangeType::FILE_TEXT) &&
|
|
|
|
($changeset->getHunks());
|
|
|
|
|
|
|
|
if ($show_encoding) {
|
|
|
|
$encoding = $this->getOriginalCharacterEncoding();
|
|
|
|
if ($encoding != 'utf8') {
|
|
|
|
if ($encoding) {
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file was converted from %s for display.',
|
|
|
|
phutil_tag('strong', array(), $encoding));
|
|
|
|
} else {
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file uses an unknown character encoding.');
|
|
|
|
}
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
if (!$messages) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($messages as $key => $message) {
|
|
|
|
$messages[$key] = phutil_tag('li', array(), $message);
|
|
|
|
}
|
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'ul',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-meta-notice',
|
|
|
|
),
|
|
|
|
$messages);
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function renderPropertyChangeHeader() {
|
|
|
|
$changeset = $this->getChangeset();
|
2014-08-13 23:41:06 +02:00
|
|
|
list($old, $new) = $this->getChangesetProperties($changeset);
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2014-08-13 23:41:06 +02:00
|
|
|
// If we don't have any property changes, don't render this table.
|
|
|
|
if ($old === $new) {
|
|
|
|
return null;
|
|
|
|
}
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
|
|
|
$keys = array_keys($old + $new);
|
|
|
|
sort($keys);
|
|
|
|
|
2014-08-13 23:41:06 +02:00
|
|
|
$key_map = array(
|
|
|
|
'unix:filemode' => pht('File Mode'),
|
|
|
|
'file:dimensions' => pht('Image Dimensions'),
|
|
|
|
'file:mimetype' => pht('MIME Type'),
|
|
|
|
'file:size' => pht('File Size'),
|
|
|
|
);
|
|
|
|
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
$rows = array();
|
|
|
|
foreach ($keys as $key) {
|
|
|
|
$oval = idx($old, $key);
|
|
|
|
$nval = idx($new, $key);
|
|
|
|
if ($oval !== $nval) {
|
|
|
|
if ($oval === null) {
|
2013-02-08 21:07:44 +01:00
|
|
|
$oval = phutil_tag('em', array(), 'null');
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
} else {
|
2013-02-08 21:07:44 +01:00
|
|
|
$oval = phutil_escape_html_newlines($oval);
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($nval === null) {
|
2013-02-08 21:07:44 +01:00
|
|
|
$nval = phutil_tag('em', array(), 'null');
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
} else {
|
2013-02-08 21:07:44 +01:00
|
|
|
$nval = phutil_escape_html_newlines($nval);
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
2014-08-13 23:41:06 +02:00
|
|
|
$readable_key = idx($key_map, $key, $key);
|
|
|
|
|
2014-08-19 23:46:37 +02:00
|
|
|
$row = array(
|
|
|
|
$readable_key,
|
|
|
|
$oval,
|
2014-10-07 15:01:04 +02:00
|
|
|
$nval,
|
2014-08-19 23:46:37 +02:00
|
|
|
);
|
|
|
|
$rows[] = $row;
|
|
|
|
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-19 23:46:37 +02:00
|
|
|
$classes = array('', 'oval', 'nval');
|
|
|
|
$headers = array(
|
|
|
|
pht('Property'),
|
|
|
|
pht('Old Value'),
|
|
|
|
pht('New Value'),
|
|
|
|
);
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
|
|
->setHeaders($headers)
|
|
|
|
->setColumnClasses($classes);
|
2013-02-13 03:46:01 +01:00
|
|
|
return phutil_tag(
|
2014-08-19 23:46:37 +02:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-property-table',
|
|
|
|
),
|
|
|
|
$table);
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
2013-01-14 23:20:54 +01:00
|
|
|
public function renderShield($message, $force = 'default') {
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
$end = count($this->getOldLines());
|
|
|
|
$reference = $this->getRenderingReference();
|
|
|
|
|
|
|
|
if ($force !== 'text' &&
|
|
|
|
$force !== 'whitespace' &&
|
|
|
|
$force !== 'none' &&
|
|
|
|
$force !== 'default') {
|
|
|
|
throw new Exception("Invalid 'force' parameter '{$force}'!");
|
|
|
|
}
|
|
|
|
|
|
|
|
$range = "0-{$end}";
|
|
|
|
if ($force == 'text') {
|
|
|
|
// If we're forcing text, force the whole file to be rendered.
|
|
|
|
$range = "{$range}/0-{$end}";
|
|
|
|
}
|
|
|
|
|
|
|
|
$meta = array(
|
|
|
|
'ref' => $reference,
|
|
|
|
'range' => $range,
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($force == 'whitespace') {
|
|
|
|
$meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
|
|
|
|
}
|
|
|
|
|
2013-01-30 19:58:21 +01:00
|
|
|
$content = array();
|
|
|
|
$content[] = $message;
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
if ($force !== 'none') {
|
2013-01-30 19:58:21 +01:00
|
|
|
$content[] = ' ';
|
|
|
|
$content[] = javelin_tag(
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'mustcapture' => true,
|
|
|
|
'sigil' => 'show-more',
|
|
|
|
'class' => 'complete',
|
|
|
|
'href' => '#',
|
|
|
|
'meta' => $meta,
|
|
|
|
),
|
2013-01-24 22:18:44 +01:00
|
|
|
pht('Show File Contents'));
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
2013-01-14 23:20:54 +01:00
|
|
|
return $this->wrapChangeInTable(
|
2013-01-30 19:58:21 +01:00
|
|
|
javelin_tag(
|
2013-01-14 23:20:54 +01:00
|
|
|
'tr',
|
|
|
|
array(
|
|
|
|
'sigil' => 'context-target',
|
|
|
|
),
|
2013-01-30 19:58:21 +01:00
|
|
|
phutil_tag(
|
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-shield',
|
|
|
|
'colspan' => 6,
|
|
|
|
),
|
|
|
|
$content)));
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
2014-11-15 01:58:24 +01:00
|
|
|
abstract protected function renderColgroup();
|
|
|
|
|
2014-04-04 00:11:06 +02:00
|
|
|
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
protected function wrapChangeInTable($content) {
|
|
|
|
if (!$content) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-03-05 23:01:52 +01:00
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'differential-diff';
|
|
|
|
$classes[] = 'remarkup-code';
|
|
|
|
$classes[] = 'PhabricatorMonospaced';
|
|
|
|
$classes[] = $this->getRendererTableClass();
|
|
|
|
|
2013-01-30 19:58:21 +01:00
|
|
|
return javelin_tag(
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
'table',
|
|
|
|
array(
|
2015-03-05 23:01:52 +01:00
|
|
|
'class' => implode(' ', $classes),
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
'sigil' => 'differential-diff',
|
|
|
|
),
|
2014-04-04 00:11:06 +02:00
|
|
|
array(
|
|
|
|
$this->renderColgroup(),
|
|
|
|
$content,
|
|
|
|
));
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|
|
|
|
|
2013-01-14 23:20:54 +01:00
|
|
|
protected function buildInlineComment(
|
|
|
|
PhabricatorInlineCommentInterface $comment,
|
|
|
|
$on_right = false) {
|
|
|
|
|
|
|
|
$user = $this->getUser();
|
|
|
|
$edit = $user &&
|
|
|
|
($comment->getAuthorPHID() == $user->getPHID()) &&
|
2015-01-30 20:17:34 +01:00
|
|
|
($comment->isDraft())
|
|
|
|
&& $this->getShowEditAndReplyLinks();
|
|
|
|
$allow_reply = (bool)$user && $this->getShowEditAndReplyLinks();
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
$allow_done = !$comment->isDraft() && $this->getCanMarkDone();
|
2013-01-14 23:20:54 +01:00
|
|
|
|
2015-03-06 14:11:29 +01:00
|
|
|
return id(new PHUIDiffInlineCommentDetailView())
|
2013-01-14 23:20:54 +01:00
|
|
|
->setInlineComment($comment)
|
2015-03-09 20:53:40 +01:00
|
|
|
->setIsOnRight($on_right)
|
2013-01-14 23:20:54 +01:00
|
|
|
->setHandles($this->getHandles())
|
|
|
|
->setMarkupEngine($this->getMarkupEngine())
|
|
|
|
->setEditable($edit)
|
Track a "Done" state on inline comments
Summary:
Ref T1460. This just barely works, but throwing it up in case any of it sounds mechanically crazy before we build integrations/UI/etc.
Specifically, these are the behaviors:
- You can mark your own draft comments as "done" before you submit them. The intent is to let reviewers mark their stuff advisory/minor/not-important before they submit it, to hint to authors that they don't expect the feedback to necessarily be addressed (maybe it's a joke, maybe it's just discussion, maybe it's "consider..").
- You can mark others' published comments as "done" if you're the revision/commit author. The intent is to keep this lightweight by not requiring an audit trail of who marked what done when. If anyone could mark anything done, we'd have to have some way to show who marked stuff.
- When you mark stuff done (or unmark it), it goes into a "draft" state, where you see the change but others don't see it yet. The intent is twofold:
- Be consistent with how inlines work.
- Allow us to publish a "epriestley updated this revision + epriestley marked 15 inlines as done" story later if we want. This seems more useful than publishing 15 "epriestley marked one thing as done" stories.
- The actual bit where done-ness publishes isn't implemented.
- UI is bare bones.
- No integration with the rest of the UI yet.
Test Plan: Clicked some checkboxes.
Reviewers: chad, btrahan
Reviewed By: btrahan
Subscribers: paulshen, chasemp, epriestley
Maniphest Tasks: T1460
Differential Revision: https://secure.phabricator.com/D12033
2015-03-10 02:41:47 +01:00
|
|
|
->setAllowReply($allow_reply)
|
|
|
|
->setCanMarkDone($allow_done);
|
2013-01-14 23:20:54 +01:00
|
|
|
}
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
|
2015-03-05 23:02:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Build links which users can click to show more context in a changeset.
|
|
|
|
*
|
|
|
|
* @param int Beginning of the line range to build links for.
|
|
|
|
* @param int Length of the line range to build links for.
|
|
|
|
* @param int Total number of lines in the changeset.
|
|
|
|
* @return markup Rendered links.
|
|
|
|
*/
|
|
|
|
protected function renderShowContextLinks($top, $len, $changeset_length) {
|
|
|
|
$block_size = 20;
|
|
|
|
$end = ($top + $len) - $block_size;
|
|
|
|
|
|
|
|
// If this is a large block, such that the "top" and "bottom" ranges are
|
|
|
|
// non-overlapping, we'll provide options to show the top, bottom or entire
|
|
|
|
// block. For smaller blocks, we only provide an option to show the entire
|
|
|
|
// block, since it would be silly to show the bottom 20 lines of a 25-line
|
|
|
|
// block.
|
|
|
|
$is_large_block = ($len > ($block_size * 2));
|
|
|
|
|
|
|
|
$links = array();
|
|
|
|
|
|
|
|
if ($is_large_block) {
|
|
|
|
$is_first_block = ($top == 0);
|
|
|
|
if ($is_first_block) {
|
|
|
|
$text = pht('Show First %d Line(s)', $block_size);
|
|
|
|
} else {
|
|
|
|
$text = pht("\xE2\x96\xB2 Show %d Line(s)", $block_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
$links[] = $this->renderShowContextLink(
|
|
|
|
false,
|
|
|
|
"{$top}-{$len}/{$top}-20",
|
|
|
|
$text);
|
|
|
|
}
|
|
|
|
|
|
|
|
$links[] = $this->renderShowContextLink(
|
|
|
|
true,
|
|
|
|
"{$top}-{$len}/{$top}-{$len}",
|
|
|
|
pht('Show All %d Line(s)', $len));
|
|
|
|
|
|
|
|
if ($is_large_block) {
|
|
|
|
$is_last_block = (($top + $len) >= $changeset_length);
|
|
|
|
if ($is_last_block) {
|
|
|
|
$text = pht('Show Last %d Line(s)', $block_size);
|
|
|
|
} else {
|
|
|
|
$text = pht("\xE2\x96\xBC Show %d Line(s)", $block_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
$links[] = $this->renderShowContextLink(
|
|
|
|
false,
|
|
|
|
"{$top}-{$len}/{$end}-20",
|
|
|
|
$text);
|
|
|
|
}
|
|
|
|
|
|
|
|
return phutil_implode_html(" \xE2\x80\xA2 ", $links);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build a link that shows more context in a changeset.
|
|
|
|
*
|
|
|
|
* See @{method:renderShowContextLinks}.
|
|
|
|
*
|
|
|
|
* @param bool Does this link show all context when clicked?
|
|
|
|
* @param string Range specification for lines to show.
|
|
|
|
* @param string Text of the link.
|
|
|
|
* @return markup Rendered link.
|
|
|
|
*/
|
|
|
|
private function renderShowContextLink($is_all, $range, $text) {
|
|
|
|
$reference = $this->getRenderingReference();
|
|
|
|
|
|
|
|
return javelin_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '#',
|
|
|
|
'mustcapture' => true,
|
|
|
|
'sigil' => 'show-more',
|
|
|
|
'meta' => array(
|
|
|
|
'type' => ($is_all ? 'all' : null),
|
|
|
|
'range' => $range,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
$text);
|
|
|
|
}
|
|
|
|
|
2015-03-05 23:03:57 +01:00
|
|
|
/**
|
|
|
|
* Build the prefixes for line IDs used to track inline comments.
|
|
|
|
*
|
|
|
|
* @return pair<wild, wild> Left and right prefixes.
|
|
|
|
*/
|
|
|
|
protected function getLineIDPrefixes() {
|
|
|
|
// These look like "C123NL45", which means the line is line 45 on the
|
|
|
|
// "new" side of the file in changeset 123.
|
|
|
|
|
|
|
|
// The "C" stands for "changeset", and is followed by a changeset ID.
|
|
|
|
|
|
|
|
// "N" stands for "new" and means the comment should attach to the new file
|
|
|
|
// when stored. "O" stands for "old" and means the comment should attach to
|
|
|
|
// the old file. These are important because either the old or new part
|
|
|
|
// of a file may appear on the left or right side of the diff in the
|
|
|
|
// diff-of-diffs view.
|
|
|
|
|
|
|
|
// The "L" stands for "line" and is followed by the line number.
|
|
|
|
|
|
|
|
if ($this->getOldChangesetID()) {
|
|
|
|
$left_prefix = array();
|
|
|
|
$left_prefix[] = 'C';
|
|
|
|
$left_prefix[] = $this->getOldChangesetID();
|
|
|
|
$left_prefix[] = $this->getOldAttachesToNewFile() ? 'N' : 'O';
|
|
|
|
$left_prefix[] = 'L';
|
|
|
|
$left_prefix = implode('', $left_prefix);
|
|
|
|
} else {
|
|
|
|
$left_prefix = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->getNewChangesetID()) {
|
|
|
|
$right_prefix = array();
|
|
|
|
$right_prefix[] = 'C';
|
|
|
|
$right_prefix[] = $this->getNewChangesetID();
|
|
|
|
$right_prefix[] = $this->getNewAttachesToNewFile() ? 'N' : 'O';
|
|
|
|
$right_prefix[] = 'L';
|
|
|
|
$right_prefix = implode('', $right_prefix);
|
|
|
|
} else {
|
|
|
|
$right_prefix = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array($left_prefix, $right_prefix);
|
|
|
|
}
|
2015-03-05 23:02:29 +01:00
|
|
|
|
2015-03-06 18:38:21 +01:00
|
|
|
protected function renderImageStage(PhabricatorFile $file) {
|
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-image-stage',
|
|
|
|
),
|
|
|
|
phutil_tag(
|
|
|
|
'img',
|
|
|
|
array(
|
|
|
|
'src' => $file->getBestURI(),
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
Implement basic one-up and test renderers
Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:
- Renderer (more methods are abstract than before)
- HTML Renderer (most HTML stuff has moved down from the base to here)
- HTML 1-up (placeholder only -- not yet a functional implementation)
- HTML 2-up (minimal changes, uses mostly old code)
- Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
- Test 1-up (selects 1-up mode for test rendering)
- Test 2-up (selects 2-up mode for test rendering)
Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:
- Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
- The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
- Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
- Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.
The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.
The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.
Test Plan: Ran unit tests, looked at a bunch of diffs.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T2009
Differential Revision: https://secure.phabricator.com/D4421
2013-01-14 23:20:06 +01:00
|
|
|
}
|