Instead of refactoring Darcs.Util.Printer, I have been working on a clean
separation of formatting for storage vs. for display. The idea is to add a
new class FormatPatch that does not use Darcs.Util.Printer, just a small
wrapper for Data.Bytestring.Builder (residing in Darcs.Util.Format) that
implements the (few) functions and operators we need for storage
formatting.
To do this, I had to remove the "show with context lines" feature from
patch bundles. (They were never meant for display to humans; what /is/
meant for human consumption is the patch-preview.txt file which we attach
to patch bundles when creating emails to send; we can always create a
separate routine to create this preview file in a way that doesn't
interfere with the bundle itself; we could even create a html version with
coloring and everything.)
This move gets us rid of the whole ugly array of types and classes in
Darcs.Patch.Format (FileNameFormat, PatchListFormat, etc) and puts
formatting patches (and, BTW, also inventories) for storage and data
transfer on a robust foundation. I have made these changes on my
experimental branch, so it depends on lots of other unpublished changes.
It would be nice if I could get most of that into screened at some
point...
|