#! /usr/bin/perl ### # review-mail.pl # # Convert the output of svn diff to a mailto url for review # # Copyright, Laszlo Systems, Inc. 2005-2006 # All rights reserved. # ### use URI::URL; use URI::Escape; use Encode qw(encode); $to = ''; $cc = 'laszlo-dev@openlaszlo.org'; $default_domain = 'laszlosystems.com'; $change_url = shift @ARGV; @lines = <>; foreach (@lines) { if (/^\s*(Change\s\S*?)\s.*$/) { $change = $1; } if (/^\s*(Summary.*?)\s*$/) { $summary = $1; } if (/Reviewer:\s*(\S+?)\s/) { $email = $1; if ($1 && $1 !~ m#n/a# && $1 !~ /(pending)/) { if ($to) { $to .= ','; } if ($email !~ /@/) { $to .= $email . '@' . $default_domain; } else { $to .= $email; } } } last if (/Details:/); } $url_string = "mailto:$to"; $query_string = "cc=$cc&subject=For Review: $change $summary&body="; $body = ""; foreach (@lines) { $body .= $_; } $body .= " Changeset: $change_url "; $url = new URI::URL($url_string); $url->query($query_string . uri_escape(encode("UTF-8", $body))); print $url->as_string;