CVSREPORT(1)

NAME
cvsreport - generate CVS activity reports

SYNOPSIS
cvsreport [options]

DESCRIPTION
cvsreport can extract changesets from a CVS repository history, then format it in plain text or HTML, and finally store it and/or send it via mail. A changeset is a set of commit operations (addition, removal, modification) which happen along a single invocation of the cvs commit command. Used from client side, it produces a report starting from an arbitrary date from a simple working copy. On the server side, it can automatically generate reports and mail them upon commit. cvsreport will read configuration settings first, then fetch the history info from the CVS repository, and run the user commands. Reports can be customized via a simple configuration file. Commands let you store or mail any number of reports to any number of targets. As a default (ie. no options and no command), cvsreport will generate an automatic text report on standard output (see COMMANDS).

EXAMPLES

cvsreport -a -d/var/cvsroot -f now-1month -n10
    Report at most ten changesets from anyone which happened a month ago on the local repository /var/cvsroot, send result as plain text on standard output.

cvsreport -d/var/cvsroot -f '2003-05-25 16:00 UTC' -e 'file text report.txt >>log.txt'
    Send all changesets commited by the current user on the local repository /var/cvsroot, starting from May, 25th 2003 at 16:00 Universal Time (GMT). A plain text output is written to report.txt and appended to log.txt.

cvsreport -a -dproject.com:/cvsroot -f now-3week-2day-1hour -e 'mail text+html foo@project.com bar@project.com'
    Send a multipart message to cvs@project.com embedding both default text and HTML outputs. It contains events from all users which happened on the remote repository project.com:/cvsroot, starting from 3 weeks, 2 days and 1 hour ago.

cvsreport -a -dproject.com:/cvsroot -f now-1week -e 'set myhtml {footer=; encoding=UTF-8} file myhtml -'
    Collect all commit events from the past week, and reports them as UTF-8 encoded HTML thru standard output. Also remove the default footer which advertises cvsreport.

AUTOMATIC MAIL ON COMMITS
If you don't specify the -f option, cvsreport notes its startup time, waits for its caller's termination, then report on any commit events which occured in between. Add this line to CVSROOT/commitinfo (via CVS!) in the repository you want to watch :
    ALL         cvsreport -e 'mail text developers@project.com commit@project.com'
Please see also the mail command configuration in the CONFIGURATION section.

OPTIONS

-a, --all
    Report commit events from all users. As a default, only report events belonging to the current user.

-c, --config config-file
    Load a user configuration file (see CONFIGURATION). It is loaded after the global configuration file (see also -l). You can use this option several times to load multiple scripts. See also -e.

-d, --cvsroot cvsroot
    Set the repository root address, works as its cvs(1) counterpart. When cvsreport is run from a working copy, the content of CVS/Root is read first, and overriden with this option if present. When run outside from a working copy, cvsreport will use the value of the CVSROOT environment variable, then override it if this option is present.

-D, --debug
    Output verbose activity information on stderr. If cvsreport detaches itself from the current tty, the output is then appended to /tmp/cvsreport.log.

-e, --execute command
    Execute a command set and/or configuration instructions. The syntax of the execute argument is the same as described in CONFIGURATION and COMMANDS.

-f, --from date
    Start fetching changesets from the given date. The date format is the versatile one from cvs(1).

-h, --help
    Display a summary of available options and commands.

-l, --local
    Ignore the global configuration file.

-n, --number n
    Parse at most n changesets. When this option is not present, there is no limit.

-v, --version
    Display the version and copyright info.

COMMANDS

file set [>>]file ...
    Write the report configured by set into the listed files. If `>>' is prepended to the file name, the report is appended to the existing file. The special file name '-' represents standard output.

mail set1[+set2] address ...
    Sends a report to the list of addresses. It is possible to send an alternative multipart message : both text and HTML versions are sent, and the content selection is done on the mail client according to its own preferences. The mail command relies on an external mailing program. It can be configured via the mail configuration set.

my variable = value ...
    Define a user variable, which can be then referred with $(name) later. See CONFIGURATION for a list of default variables.

run command [args] ...
    Run a user command with its argument. It is only called if there is at least one commit event reported, and it is called no more than once per report. It can be useful to run a single command per changeset from a CVS repository, instead of the default CVS recursive filter invocation (one call for every modified folder).

test
    This dummy command forces cvsreport to retrieve the CVS history even if there's no effective command to execute afterwards. Useful for diagnosis with --debug.

CONFIGURATION
A configuration script defines so-called sets which are a simple collection of key/value pairs, and can also include a list of commands executed at load time. Here are the startup defaults written as a configuration script :
    # Default text set
    set text {
      format   = text
      encoding = iso-8859-1
    }
    # Default HTML set
    set html {
      format       = html
      encoding     = iso-8859-1
      title        = message
      footer       = Generated by cvsreport $(version)
      cgi_links    = no
      cgi_urlbase  = please_set_cgi_urlbase
      cgi_download = no
    }
    # Defaults for the mail command
    set mail {
      command  = mail
      subject  = message
      from     =
      reply-to =
    }
The syntax does not require whitespaces, they are only recommended for clarity. The statement separator can be either a newline or a semi-colon. Comments are not allowed after a statement, they are only accepted on their own line. Variables, denotated by the $(name) syntax, are substituted with their value at load time. cvsreport automatically defines some variables :

    version
        The current cvsreport version

    localtime
        The current time, expressed in the host time zone.

    gmtime
        The current time in GMT (or UTC).

    sfproject
        The project name when hosted on a SourceForge-based site. It is extracted from the parent folder of the CVSROOT.
Every set can be used to describe a report or configure a command. The text set is the default text mode report. To create your own text report, declare a set whose format field is set to text. It will automatically inherit the values from the default text set. Similarly, html is the default set for HTML based reports. If you create a set with a format field set to html, it will inherit the default values from the default HTML text set. These fields are common to both text and HTML reports :

    encoding
        Defines the document character set. Note that it is currently only used for the HTML document charset and the mail encoding header, no special conversion or character handling is actually done.

    diff
        Selects some files whose difference has to be included in the report. Expects a comma separated list of regular expressions. These regexes are matched against the files full path (module/path/file).
The following fields are specific to the text report :

    diff_format
        Can be set to either unified or context. If unset, uses the local user CVS settings or global defaults.
The following fields are specific to the HTML report :

    title
        Set the page title (not displayed in document body). If set to message, automatically extracts the first line of the first changeset log message.

    footer
        Set the page footer text. As a default, advertise cvsreport with a simple link to its home page.

    cgi_links
        If set to yes, add CVSweb/ViewCVS hyperlinks to version numbers and diff symbols.

    cgi_urlbase
        If cgi_links is active, set the CGI base location.

    cgi_download
        If set to yes, links will download file revisions 'as is'.
The mail command can be configured with the mail set. The following fields are available :

    command
        Set the command invoked to send mail. It can be either internal or the name of an external program. The internal mailer uses SMTP directly. If the smtp_server parameter is not set, the default SMTP server configured in Net::Config will be used. The external command is expected to accept the standard BSD mailx behaviour : -a for headers, -s for subject, addresses as regular arguments and body received via stdin.

    smtp_server
        Set the name of the SMTP server when the internal mailer is used. Ignored if an external mail program is used.

    subject
        Set mail subject. If set to message, automatically extracts the first line of the first changeset log message.

    from
        Set the sender name and address. If unspecified, is forged from various information sources.

    reply-to
        If set, add as a regular Reply-To header to every mail sent.
If no command is given to cvsreport, it automatically issues a file text - command. You can also use scripts to specify a list of commands, using the syntax described in COMMANDS. These commands are collected at start up time and all executed when the history has been retrieved.

FILES
/etc/cvsreport.conf
    The global configuration file.
/tmp/cvsreport.log
    The debug output when there is no tty (eg. on server side).

ENVIRONMENT

CVSROOT
    The value of CVSROOT is used like in cvs (1), see the -d option.

CVS_RSH
    Set the access method for an external cvsroot (rsh, ssh), see cvs (1).

CVSREPORT_DEBUG
    When set, equivalent to the --debug option.

NOTES
cvsreport expects the proc filesystem to be mounted.

BUGS
Working on remote repositories is awfully slow (blame CVS).
Usage of whitespace in file or folder names messes cvsreport up (blame again CVS).

AUTHOR
Written by Vincent Caron <v.caron@zerodeux.net>

COPYRIGHT
Copyright © 2003 Vincent Caron.
This is Free Software released under the GNU GPL license.

SEE ALSO
cvs(1), mail(1)