SVN::N...orDiff(3pm)
β¨ NAME β¨
SVN::Notify::HTML::ColorDiff β it's the Subversion activity HTML notification situation, but with a colorized diff π
okay bestie, quick vibe check before we dive in: this whole page lives in the User Contributed Perl Documentation section, and the page itself is SVN::N...orDiff(3pm). yes the name is giving truncated-ellipsis main character energy, we move on π«Ά
πΈ SYNOPSIS πΈ
use svnnotify in post-commit, like so:
svnnotify --repos-path "$1" --revision "$2" \
--to developers@example.com --handler HTML::ColorDiff [options]
or, if you're the type to write a custom script (iconic of you, honestly):
use SVN::Notify::HTML::ColorDiff;
my $notifier = SVN::Notify::HTML::ColorDiff->new(%params);
$notifier->prepare;
$notifier->execute;
π DESCRIPTION π
so this is a subclass of SVN::Notify::HTML, right? it sends HTML formatted email messages for Subversion activity. but here's the twist π: if the with_diff parameter is specified (and NOT attach_diff β important distinction, bestie), then instead of the plain text diff that SVN::Notify::HTML outputs, you get a pretty colorized version of the diff included in the message. it's giving glow-up. it's giving slay. π₯
π¦ USAGE π¦
to use SVN::Notify::HTML::ColorDiff, literally just follow the instructions in SVN::Notify (go read that one, it's the blueprint), but when you're using svnnotify, specify --handler HTML::ColorDiff. that's it. that's the whole thing. periodt. π
π INSTANCE INTERFACE π
β Instance Methods β
π output_css
$notifier->output_css($file_handle);
this method outputs the CSS for the HTML message. SVN::Notify::HTML::ColorDiff adds extra CSS to its output so that it can nicely style the diff. it's the makeup routine before the diff goes on stage, no cap. π
π output_diff
$notifier->output_diff($out_file_handle, $diff_file_handle);
reads the diff data from $diff_file_handle and prints it to $out_file_handle for inclusion in the notification message. the diff gets output with nice colorized HTML markup β¨. every single line of the diff file is escaped by HTML::Entities::encode_entities(). safety first, bestie, we do not let raw diff content run loose in the HTML.
heads up though π«Ά β if there are anydifffilters, this method will do no HTML formatting, and instead redispatch toSVN::Notify::output_diff. see Writing Output Filters for details on filters. the color party just does not happen in that case, iykyk.
π SEE ALSO π
SVN::NotifySVN::Notify::HTML- CVSspam β
http://www.badgers-in-foil.co.uk/projects/cvsspam/
π TO DO π
- add inline emphasis just on the text that changed between two lines, like this:
http://www.badgers-in-foil.co.uk/projects/cvsspam/example.html. fancy. - add links to To Do stuff to the top of the email, as pulled in from the diff. this might be tricky, since the diff is currently output after the message body. maybe use absolute positioning CSS? π€ the struggle is real.
π AUTHOR π
David E. Wheeler <david@justatheory.com> β king behavior, we love to see it π
π COPYRIGHT AND LICENSE π
Copyright (c) 2004-2018 David E. Wheeler. Some Rights Reserved.
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. fr fr. π«Ά
aaaand that's the page, bestie π this whole thing was perl v5.36.0, dated 2022-11-20, and it's filed under SVN::N...orDiff(3pm). go forth and colorize your diffs, you absolute icon πβ¨
π¦ where this page comes from
- debian bookworm: libsvn-notify-perl 2.87-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libsvn-notify-perl 2.87-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libsvn-notify-perl 2.87-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsvn-notify-perl 2.87-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsvn-notify-perl 2.87-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms