Preventing svn diff with PDF files

80 views
Skip to first unread message

HOWELL G.S.J.

unread,
Feb 26, 2008, 6:35:59 AM2/26/08
to trac-...@googlegroups.com
Dear All:

I just looked at a changeset where a PDF document got overwritten with a
new, updated version of it. Trac showed me a full textual diff - which
caused my server's CPU to get alarmingly busy for a few moments.

I don't want to see this diff, but I do want to see the summary of files
that have changed.

The PDF file in question has the following properties set:

Property svn:mime-type set to application/pdf
Property svn:executable set to *

(I'm not sure why executable is on, but I don't think it makes any
difference in this situation).

Is there a way I can prevent Trac from showing me the full text diff
between the revisions of the PDF when I'm looking at the changeset?
Naturally, I still want to see diffs for other types of files.

Cheers

G.

Michael Renzmann

unread,
Feb 26, 2008, 7:14:49 AM2/26/08
to trac-...@googlegroups.com
Hi.

> I just looked at a changeset where a PDF document got overwritten with a
> new, updated version of it. Trac showed me a full textual diff - which
> caused my server's CPU to get alarmingly busy for a few moments.

Having uuencoded files in our repository, we did face a similar issue on
madwifi.org. The following patches solved the issue for us:

http://projects.otaku42.de/changeset/116
http://projects.otaku42.de/changeset/117

It shouldn't be too hard to adjust these patches to apply cleanly against
Trac 0.10.4.


These changes introduce the new parameter "suppress_file_diffs" in the
[changeset] section, allowing you to define one or more patterns. Files
with a matching name won't be shown in the repository browser, and diffs
for changes to such files won't occur in the changeset browser.

For example, on madwifi.org we use the following setting:

[changeset]
suppress_file_diffs = *.uu

To see it in action, have a look at changeset 1711 [1]. That changeset
modified many uuencoded files as well as some "normal" source files. The
changeset browser still shows which .uu-files have been modified, but the
actual diffs for such files are suppressed.

Now try to view the content of such a .uu-file in the browser at [2]; you
will only see a message saying that HTML preview has been disabled for
this file.

It's probably not the most elegant implementation for such a purpose, but
it's been sufficient for our own purposes.


You might want to give the following settings a try:

[changeset]
suppress_file_diffs = *.pdf

Hope this helps.

Bye, Mike

[1] http://madwifi.org/changeset/1711
[2] http://madwifi.org/browser/trunk/hal/public/i386-elf.hal.o.uu?rev=1711

HOWELL G.S.J.

unread,
Feb 26, 2008, 9:35:35 AM2/26/08
to trac-...@googlegroups.com
Many thanks for the tip.

I can't get the patches to work as they are, so I'll probably have to do
this by hand. Not being a Python programmer, this is a little
intimidating, but I'll give it a try.

I am alone in thinking that this useful functionality probably ought to
be in the main distribution..?

Thanks again

G.

Reply all
Reply to author
Forward
0 new messages