Mailing List Archive

[PATCH] Migration of diff generation to templates (ticket #310)
Howdy,

I've attached a patch that moves the generation of HTML diffs out of
the python code in Changeset.py and into the templates, so that the
python code does no longer generate any HTML tags itself, but instead
builds an HDF dataset to be passed into the templates.

The HDF model I've chosen looks something like this:

diff.files {
0 {
name.old = "README.txt"
name.new = "README.txt"
changes {
0 {
line.old = 12
line.new = 12
blocks {
0 {
type = "unmod"
text.old = "Bla bla bla"
text.new = "Bla bla bla"
}
1 {
type = "rem"
text.old = "Foo bar"
text.new = ""
}
}
}
}
}
}

So, a 'diff' has one or more files, each file has a new and an old
name, as well as one or more 'changes'. Every change has two line
offsets (old/new), and one or more 'blocks', where each block can be
one of four types: "unmod", "mod", "add", "rem". Possibly, using "left"
and "right" would have been better than "old" and "new", but that's
easy to change.

Naturally, the patch is a bit on the large size, but I hope it'll be
relatively easy to review. I've done my best to only touch code where
it was absolutely necessary :-)

Cheers,
Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: trac_310.patch
Type: application/octet-stream
Size: 13363 bytes
Desc: not available
Url : /archive/trac/attachments/20040509/717f0ee7/trac_310.a
-------------- next part --------------


--
Christopher Lenz
/=/ cmlenz at gmx.de
[PATCH] Migration of diff generation to templates (ticket #310) [ In reply to ]
Hey Chris,

> I've attached a patch that moves the generation of HTML diffs out of the
> python code in Changeset.py into templates

Cool stuff. I cleaned up the patch a bit and merged it to Trunk. I also fixed
a bug preventing display of multi-file diffs (as discussed on the IRC channel
earlier).

Commited in changeset [481].

Great work, it's greatly appreciated. :)

Cheers,

--
Daniel Lundin | Edgewall Software
daniel@edgewall.com | Professional Linux & Open Source Consulting
| http://www.edgewall.com/