Split DiffChunkGenerator into a general-purpose RawDiffChunkGenerator.
Review Request #7093 — Created March 19, 2015 and submitted — Latest diff uploaded
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
subclassesRawDiffChunkGenerator
, doing all the work
of handling interdiffs and generating suitable content fromFileDiffs
to
pass down to theRawDiffChunkGenerator
functions.Along with this,
DiffOpcodeGenerator
no longer needsFileDiff
s as well.
It only ever needed the diff content stored on them, for interdiff
processing, so we just pass that directly inDiffChunkGenerator
.
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.