SVN::N...orDiff(3pm)

πŸ“¦
version 2.87 Β· 2 versions
  • 2.87 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 2.87 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 any diff filters, this method will do no HTML formatting, and instead redispatch to SVN::Notify::output_diff. see Writing Output Filters for details on filters. the color party just does not happen in that case, iykyk.

πŸ” SEE ALSO πŸ”


πŸ’€ TO DO πŸ’€

  1. 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.
  2. 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 (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