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 {
|
|
|
|
|
|
|
|
protected function renderChangeTypeHeader($force) {
|
|
|
|
$changeset = $this->getChangeset();
|
|
|
|
|
|
|
|
$change = $changeset->getChangeType();
|
|
|
|
$file = $changeset->getFileType();
|
|
|
|
|
2014-06-20 20:49:41 +02:00
|
|
|
$messages = array();
|
|
|
|
$none = hsprintf('');
|
|
|
|
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:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This image was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This directory was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This binary file was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This symlink was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This submodule was <strong>added</strong>.',
|
|
|
|
$none);
|
|
|
|
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:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This file was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_IMAGE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This image was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_DIRECTORY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This directory was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_BINARY:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This binary file was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SYMLINK:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This symlink was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
break;
|
|
|
|
case DifferentialChangeType::FILE_SUBMODULE:
|
|
|
|
$messages[] = pht(
|
|
|
|
'This submodule was <strong>deleted</strong>.',
|
|
|
|
$none);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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(
|
|
|
|
'class' => 'differential-diff remarkup-code PhabricatorMonospaced',
|
|
|
|
'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 renderInlineComment(
|
|
|
|
PhabricatorInlineCommentInterface $comment,
|
|
|
|
$on_right = false) {
|
|
|
|
|
|
|
|
return $this->buildInlineComment($comment, $on_right)->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2013-01-14 23:20:54 +01:00
|
|
|
|
|
|
|
return id(new DifferentialInlineCommentView())
|
|
|
|
->setInlineComment($comment)
|
|
|
|
->setOnRight($on_right)
|
|
|
|
->setHandles($this->getHandles())
|
|
|
|
->setMarkupEngine($this->getMarkupEngine())
|
|
|
|
->setEditable($edit)
|
|
|
|
->setAllowReply($allow_reply);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
}
|