Split DiffChunkGenerator into a general-purpose RawDiffChunkGenerator.

Review Request #7093 — Created March 19, 2015 and submitted — Latest diff uploaded

Information

Review Board
release-2.5.x
3b0ad74...

Reviewers

DiffChunkGenerator is a very useful and powerful class for producing a
set of chunks we can directly use for rendering diffs. To use it, it
required the whole diff machinery: FileDiff models, DiffSet,
repositories, the patching process, etc. That made it impractical for
any usage beyond showing diffs of files in a repository.

This change splits the heavy processing out into a RawDiffChunkGenerator
class, which can be used to generate chunks from any two strings.

DiffChunkGenerator subclasses RawDiffChunkGenerator, doing all the work
of handling interdiffs and generating suitable content from FileDiffs to
pass down to the RawDiffChunkGenerator functions.

Along with this, DiffOpcodeGenerator no longer needs FileDiffs as well.
It only ever needed the diff content stored on them, for interdiff
processing, so we just pass that directly in DiffChunkGenerator.

Browsed diffs and interdiffs, comparing them to versions without the path.
This covered all types of changes, including indentation. I didn't see any
differences in behavior.

Tested with raw strings, and got chunks out of them.

Unit tests pass.

    Loading...