1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 10:18:48 +02:00
Commit graph

6 commits

Author SHA1 Message Date
epriestley
612b29fff4 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 14:20:06 -08:00
epriestley
6a69108358 Simplify context parsing and add test coverage
Summary:
  - Remove 'missingNew', etc. It's impossible for a diff to popluate these, as far as I can tell (I can't generate such a diff, or find any which generate it).
  - Add unit tests.

Test Plan: Unit tests, viewed a diff with some missing context.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4393
2013-01-10 16:06:39 -08:00
epriestley
62bc3373e5 Fix error with inline comments on images
Summary: This data structure is a `dict<int, list<Comment>>` now, where the `int` is the line number.

Test Plan:
  - Created a diff changing an image.
  - Added inline comments on the left and right sides of the diff.
  - Saw some exceptions and general sadness.
  - Applied patch.
  - Reloaded page.
  - Everything worked great.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D4264
2012-12-21 14:16:00 -08:00
Bob Trahan
c970f7e89c refactor pass 2 of N on DifferentialChangesetParser and bonus bug fix
Summary: pull out some more stuff from the TwoUp renderer that's generically useful. also clean up $xhp variable and add a get method for the $coverage. Finally, fix T2177 while I'm in here.

Test Plan: played around with Differential. Also opened things up in Firefox to verify T2177.

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2009, T2177

Differential Revision: https://secure.phabricator.com/D4161
2012-12-11 17:16:11 -08:00
Bob Trahan
638449b483 removed some debugging code from D4117
Summary: whoops!

Test Plan: no more debugging code

Reviewers: epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4121
2012-12-07 18:08:27 -08:00
Bob Trahan
75e8ff26f5 Refactor DifferentialChangesetParser -- pass 1 of N
Summary:
basically did my darnedest to pull out a TwoUp rendering view. Made a base class for the rendering views with "old" and "new" terminology rather than "left" and "right.

Future revisions will finish cleaning up the terminology within the DifferentialChangesetParser itself and more of the ideas within T2009.

Test Plan: been playing with differential all day

Reviewers: epriestley

Reviewed By: epriestley

CC: vrana, chad, aran, Korvin

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4117
2012-12-07 16:19:57 -08:00