On Wed, Feb 16, 2011 at 1:01 PM, Marco Peereboom <sl...@peereboom.us> wrote:
> Man I'd love an example for this.

something like this. Note that there may be issues with source files
with spaces and/or files names that contain commas. Those cases are
not tested. The script can be "smarter".

# -- BEGIN
CVSROOT/loginfo:

# Some info from: http://www.network-theory.co.uk/docs/cvsmanual/loginfo.html

# Format of each line is:
# regular-expression    filter-program args [...]
#
# pattern to match against directory entry being changed.
# So if your repository is something generic like OpenBSD's
# "src", you probably want to use "^src"
#
# The filter script/program to execute comes next with arguments.
# Part of the arguments can be a format string where:
#
#       %s is the file name being changed
#       %t tag name
#       %V old revision number (pre-check-in)
#       %v new revision number (post)
#
# Multiple format chars may be used but must be enclosed within
# curly-braces (e.g., %{sVv}).
#
# The format string will expand to:
#
#       "repository-subdir format-specifier-list-of-changed-files"
#
# e.g., If the repository is the OpenBSD "src" and the change is
# made to sys/dev/pci/azalia.c and sys/dev/pci/azalia.h, and the
# format specifier is "%{sVv}", the first argument to filter-program
# will be:
#
#       "sys/dev/pci azalia.c,1.187,1.188 azalia.h,1.61,1.62"
#
# Assuming azalia.c is at rev 1.187 and azalia.h is at 1.61.

^src    /path/to/filter.pl %{sVv}


# So your filter.pl may be something like:

#! /usr/bin/perl -w
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

use strict;

# Assumes CVSROOT env is set correctly.

my      ($mail, $subdir, @files, @email);

# XXX FIXME!
# Adjust mailing list here, or make it part of params in the loginfo
# filter line as an additional arg to filter-program.
@email = qw{sl...@example.com nlegr...@example.com
                m...@example.com};

# First arge is "sub-dir fileschanged,old-rev,new-rev ..."
($subdir, @files) = split(/ /, $ARGV[0]);

# Send email to @email list
$mail = sprintf("mail -s \"cvs: changes in %s\" ", $subdir);
$mail .= join(',', @email);

open(MAIL, "| $mail") or die("Failed to open mail: $!");

# Need to read input from 'cvs commit'. Send it as the mail message.
while (<STDIN>) {
        print(MAIL $_);
}

# Do cvs diffs for each changed file.
for my $f (@files) {
        my      ($o, $old, $new, $src);

        ($src, $old, $new) = split(/,/, $f);

        print(MAIL "\n-- diff -r$old -r$new $src --\n");
        $o = qx{cvs -nq diff -up -r$old -r$new $src};
        print(MAIL "$o\n");
}

close(MAIL);
# -- END

enjoy,
--patrick




> On Feb 16, 2011, at 13:32, "Nicolas P. M. Legrand" <nlegr...@ethelred.fr> 
> wrote:
>
>> On Wed, Feb 16, 2011 at 11:16:01AM -0800, patrick keshishian wrote:
>>> On Wed, Feb 16, 2011 at 10:29 AM, Nicolas P. M. Legrand
>>> <nlegr...@ethelred.fr> wrote:
>>>> On Wed, Feb 16, 2011 at 12:01:22PM -0500, Luis Useche wrote:
>>>>> One thing I would really like to see is the diffs of every commit. This is
>>>>> available for DragonflyBSD for instance. Is there a way to find this on
>>>>> OBSD?
>>>>
>>>> CVS and git are very different I don't think you can easily have this
>>>> feature with CVS (if it exists I'd be glad to know it :)). Personally
>>>
>>> Sure it can. see CVSROOT/loginfo. You define a filter and need a
>>> filter-script that will take files with changed revisions, do the 'cvs
>>> diff' and mail out the outputs.
>>
>> ha thanks! I'll have a look.

Reply via email to