Just a Theory

Trans rights are human rights

Posts about activitymail

SVN::Notify 2.50

SVN::Notify 2.50 is currently making its way to CPAN. It has quite a number of changes since I last wrote about it here, most significantly the slick new CSS treatment introduced in 2.47, provided by Bill Lynch. I really like the look, much better than it was before. Have a look at the SVN::Notify::HTML::ColorDiff output to see what I mean. Be sure to make your browser window rally narrow to see how all of the sections automatically get a nice horizontal scrollbar when they’re wider than the window. Neat, eh? Check out the 2.40 output for contrast.

Here are all of the changes since the last version:

2.50 2005-11-10T23:27:22
  • Added --ticket-url and --ticket-regex options to be used by those who want to match ticket identifers for systems other than RT, Bugzilla, GNATS, and JIRA. Based on a patch from Andrew O’Brien.
  • Removed bogus use lib line put into Makefile.PL by a prerelease version of Module::Build.
  • Fixed HTML tests to match either “’” or “'”, since HTML::Entities can be configured differently on different systems.
2.49 2005-09-29T17:26:14
  • Now require Getopt::Long 2.34 so that the --to-regex-map option works correctly when it is used only once on the command-line.
2.48 2005-09-06T19:14:35
  • Swiched from <span class="add"> and <span class="rem"> to <ins> and <del> elements in SVN::Notify::HTML::ColorDiff in order to make the markup more semantic.
2.47 2005-09-03T18:54:43
  • Fixed options tests to work correctly with older versions of Getopt::Long. Reported by Craig McElroy.
  • Slick new CSS treatment used for the HTML and HTML::ColorDiff emails. Based on a patch from Bill Lynch.
  • Added --svnweb-url option. Based on a patch from Ricardo Signes.
2.46 2005-05-05T05:22:54
  • Added support for “Copied” files to HTML::ColorDiff so that they display properly.
2.45 2005-05-04T20:38:18
  • Added support for links to the GNATS bug tracking system. Patch from Nathan Walp.
2.44 2005-03-18T06:10:01
  • Fixed Name in POD so that SVN::Notify’s POD gets indexed by search.cpan.org. Reported by Ricardo Signes.
2.43 2004-11-24T18:49:40
  • Added --strip-cx-regex option to strip out parts of the context from the subject. Useful for removing parts of the file names you might not be interested in seeing in every commit message.
  • Added --no-first-line option to omit the first sentence or line of the log message from the subject. Useful in combination with the --subject-cx option.
2.42 2004-11-19T18:47:20
  • Changed “Files” to “Paths” in hash returned by file_label_map() since directories can be listed as well as files.
  • Fixed SVN::Notify::HTML so that directories listed among the changed paths are not links.
  • Requiring Module::Build 0.26 to make sure that the installation works properly. Reported by Robert Spier.

Enjoy!

Looking for the comments? Try the old layout.

CVS diff Options Finally Fixed

Better late than never!

Looking for the comments? Try the old layout.

SVN::Notify 2.10 Generalizes Behavior

It’s all Autrijus’ fault.

As I mentioned last week when I released SVN::Notify 2.0, Autrijus has suggested using SVN::Notify as the base class for modules that do other things, such as send instant messages or update a checkout for backup purposes. Instantly seeing the value in this, I further realized that I could greatly simplify the support for HTML notification emails by moving the HTML-specific code to a subclass and then just let polymorphism do the work.

The result SVN::Notify 2.10. To simplify the move to a subclass for the HTML notifications, I broke up the old send() method into a large number of other methods that affect various parts of the composition of the email, such as headers, starting the message, outputting the log message, the file list, and outputting or attaching the diff. Then I just overrode the few methods that need different behavior in the subclass, and it all worked!

I realized, as I worked on it, I also realized that I was following the same principals that Ovid has written about with regard to the use of if. I was able to remove quite a few of them by moving HTML to a subclass. Of course, there are still some to enable diffs to be either included in an email or attached, but I didn’t want to split things up too much, or I’d have a geometric explosion of subclasses!

The svnnotify script, in the meantime, remains largely unmodified. The only change is the deprecation of the --format option in favor of a new option, --handler. Use this option to specify what subclass of SVN::Notify should handle the notification. So far, there’s just one, --format HTML, but I’m sure that Autrijus will soon add --format Jabber, and I’d like to add --format HTML::ColorDiff, myself. I might have to move the processing of command-line arguments out of svnnotify and into SVN::Notify, instead, so that subclasses can add new options. We’ll see what comes up.

Other changes to SVN::Notify include:

  • Added code to Build.PL to set the shebang line in the test scripts. Reported by Robert Spier.
  • Changed name of attached diff file to be named for the revision and the committer, rather than the committer and the date. Suggested by Robert Spier.
  • Added Author, Date, and Revision information to the top of each message.
  • The ViewCVS URL is no longer output for each file. A single link for the entire revision number is put at the top of the email, instead. ViewCVS Revision URL syntax pointed out by Peter Valdemar Morch.
  • Changed the send() method to execute() to better reflect its generalized use as the method that executes actions in response to Subversion activity.
  • The tests no longer require HTML::Entities to run. The HTML email tests will be skipped if it is not installed.
  • Added accessor methods for the attributes of SVN::Notify.

Enjoy!

Looking for the comments? Try the old layout.

SVN::Notify 2.00 Hits CPAN

I’ve released SVN::Notify, a port of my widely-used activitymail script from CVS to Subversion and from a script to a genuine class.

Enjoy!

Originally published on use Perl;

SVN::Notify 2.0 Hitting CPAN

My latest Perl module, SVN::Notify 2.00, has hit CPAN. This is a port of my widely-used activitymail CVS notification script to Subversion. But it underwent quite a few changes over the port, including:

Modularization
The old monolithic activitymail script is gone. It has been replaced with a Perl class, SVN::Notify, that does most of the work. The new script, svnnotify, is essentially just a wrapper around the class; all it does is process command-line arguments and then pass the results to SVN::Notify.
Simplification
Subversion’s system for hooking in to commit transactions is far better thought-out than that of CVS. It’s now easy to capture the results of an entire commit in a single transaction, without having to write out temp files to keep track of where we are and to concatenate diffs. As a result, SVN::Notify has a much simpler architecture and implementation that requires fewer third-party modules to do its work. In addition, the move to a class should make it much easier to build on SVN::Notify in the future than it was with activitymail. Autrijus Tang already suggested a number of ideas on IRC, including SVN::Notify::Jabber or SVN::Notify::Export. Have at it, everyone!
Reduced Resource Usage
I had heard some complaints that, on very large commits, activitymail could end up taking up a huge amount of memory. As best I could figure, this was because it was loading everything into memory, including the diff for the commit! SVN::Notify avoids this problem by using a file handle to read in a diff an print it to sendmail one line at a time. This should keep resource usage by SVN::Notify way below what activitymail used.
Context-Specific Notifications
SVN::Notify has added support for mapping email addresses to regular expressions. Whenever a regular expression matches the name of one or more of the directories affected in a single commit, the corresponding email address will be added to the list of recipients of the notification. This is a great way to get notification messages sent to particular email addressed based on what part of the Subversion tree was affected by a commit. I intend to use this to set it up so that a list of translators only get notification about a commit when it changes a directory related to localization in my projects, so that they can ignore commits to other parts of the application.

These are the major changes, but SVN::Notify also features a number of smaller improvements over its activitymail ancestor, including character set support, user domain support for the “From” header, explicit specification of a “From” header, properly escaped content when sending HTML-formatted notifications, and a maximum subject length configuration.

So what did it lose? Just a few things:

  • syncmail-like behavior. Did anyone ever use this? If so, feel free to implement SVN::Notify::Syncmail.
  • Arguments to diff. SVN::Notify just uses svnlook diff to generate a diff. Support for other diffs could be added in a future version, if people really need it.
  • New directories and imports can no longer be ingored, because in Subversion they’re really no different from any other commit.
  • Limit on the maximum size of the email. This is because SVN::Notify no longer loads the entire email into memory to measure it.
  • Excluding certain files from the diff. Subversion handles this itself by paying attention to the media type of each file.
  • Windows support. Actually, I’m not sure if activitymail was ever used on Windows, but the new method of using pipes to communicate with other processes isn’t supported by Windows, as near as I can tell. There are comments in the code for those who wish to do the port; it would probably be easy using Win32::Process.

Not too much, eh? Let me know what you think, and send feedback!

Looking for the comments? Try the old layout.

activitymail 1.19

I’m pleased to announce the release of activitymail 1.19, currently finding its way to a CPAN mirror near you. This release has a new feature I’ve been wanted to add for a long time, ever since Ask mentioned it to me a couple of years ago. A patch from Gary Meyer ported log_accume’s -I and -E options, which specify files with a list of regular expressions that can be used to exclude certain files from being processed via a commit. Now, this was the feature I wanted, but wasn’t exactly how I wanted to do it.

So starting with Gary’s patch, I’ve modified the -I and -E options to instead take one or more regular expressions right on the command line. These regular expressions are then compared to each file processed during the CVS activity, and then either include the file (in the case of a -I regular expression) or exclude the file (in the case of a -E regular expression). Needless to say, both -I and -E cannot be included in a single invocation of activitymail. You can even pass multiple regular expressions to a single -I or -E option, delimited by an empty space. This means you can’t use spaces in your regular expressions, though; use \s, instead.

The expected use for these new options is in combination with the regular expressions in the CVS loginfo file. You can specify that activitymail be executed for a particular directory, and then use -I or -E to include or exclude specific files in that directory.

One other new feature of activitymail 1.19 is the new -q and -Q options. Both options enable a quiet mode for activitymail, eliminating the status messages typically printed out during a commit (such as “Collecting file lists…” and “Sending email”). The -q option can be used for most cases; the -Q option is exactly the same, except that it also silences the status message output when an email is larger than the size specified by the -M option.

Enjoy!

David

Originally published on use Perl;

activitymail 1.18

Just thought I’d pop a quick note here to announce that I’ve released activitymail 1.18, now wending its way to a CPAN mirror near you. This release of the CVS activity notification program fixes a bug introduced in 1.16 that prevented activitymail from properly handling file names with spaces. I’ve also added a To Do section for some of the things I’d like to change going forward. Patches welcome!

Originally published on use Perl;

activitymail 1.10

It is my pleasure to announce the release of the activitymail 1.10, available shortly from your nearest CPAN mirror.

This is a major upgrade to my little CVS notification program, but I think I got all of your requests in there (although some of the options have changed, and the code you might have sent me most certainly has changed!) Here’s what you can look forward to as soon as your CPAN mirror syncs:

  • Added empty lines between the text of the commit message and the attached diff. This looks neater in mail clients that display attachments inline.

  • Added -H option sending HTML email. Thanks to Hernan Otero for the initial implementation.

  • Added -V option to include revision numbers after each listed file. Thanks to Hernan Otero for the initial implementation.

  • Cut down on the number of times that data is copied in the script, thus reducing processing time and memory requirements, especially on big commits.

  • Added -w option for a link to a CVSWeb view of the diff for each changed file. Actually looks best when used with HTML. Thanks to Hernan Otero for the initial implementation.

  • Added check for binary files so that they won’t be diffed.

  • Added -B option to specify a list of binary file name extensions to indicate files that should not be diffed.

  • New files and deleted files are now diffed against /dev/null in order to provide a more realistic diff.

  • Added -j option to point to a diff executable to compare added and deleted files. Defaults to “diff”, assuming that it’s in the path.

  • Added -M option to prevent messages over a maximum size from being emailed. Thanks to Sam Tregar.

  • Added -S option to add directory context information to the subject. Thanks to Kent Lindquist.

  • Branch tags are now listed in the email under their own header. Suggested by David Krembs.

  • Added -v option to print the version number.

  • Added POD tests.

  • Switched to Module::Build for installation.

Enjoy!

— David

Originally published on use Perl;