The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

VcsTools::LogParser - Perl class to translate RCS based log to info hash

SYNOPSIS

 my $ds = new VcsTools::LogParser (description => $big_hash);

 my @log = <DATA>;
 my $info = $ds->scanHistory(\@log) ;

 my $piledInfo = $ds->pileLog
  (
   'pile_test',
   [
    [ '3.10', $info->{'3.10'}],
    ['3.11', $info->{'3.11'}],
    ['3.12', $info->{'3.12'}],
    ['3.13', $info->{'3.13'}],
   ]
  ) ;

 print $ds->buildLogString ($piledInfo);

DESCRIPTION

This class is used to translate the log of a VCS file into a hash containing all relevant informations and vice-versa.

Currently, LogParser should work on all RCS based VCS systems. It has been tested with RCS and HP HMS.

The description hash ref defines the informations that are contained in the log of each version of the VCS file.

LogParser can also concatenate several logs into one according to the rules defined in the description hash.

Contructor

new(...)

  • description: has ref containing the description of the fields that can be found in the VCS log.

  • readHook: Sub ref. See scanHistory method.

Methods

scanHistory(log)

Analyse the history of a file and returns a hash ref containing all relevant informations. The keys of the hash are made from the revision numbers found in the history log.

The log can be either a string or an array ref.

Once the log has been analysed and the informations have been stored in the info hash according to the description, the 'readHook' passed to the constructor will be called with the info hash ref as parameter. This gives user the possibility to add its custom treatments to get more informations from the log.

getDescription()

Return the hash ref describing the VCS log.

buildLogString(info_hash_ref)

Returns a log string from the info hash. The log string may be archived as is in the VCS base.

pileLog(...)

Returns an info hash made of all informations about revision passed in the array ref.

Parameters are:

  • The first parameter is the name of the concerned Vcs file. This field is necessary to build a readable cumulated log.

  • The second parameter is an array ref made where each element is an array ref made of the version number and the info hash ref of this revision. (See example below)

DESCRIPTION FORMAT

Each element of the array is a hash ref. This hash ref contains :

  • name : name of the field as seen by the user or by the VCS system.

  • var : variable name used in internal hash (default = name), and through the VcsTools objects.

  • type : is either line, enum or array or text (see below)

  • values : array ref containing the possible values of enum type (ignored for other types)

  • mode : specifies if the value must be hidden (h) from the user or if it can be only read or also modified by the user (h|r|w) (default 'w')

  • pile: specify how the information are cumulated. (optional)

    For array data type, it can be 'push'. In this case, the array elements are pushed, then sorted and redundant infos are discarded.

    For text data type, is can be 'concat'. In this case, the text strings are concatenated together and with each file name and revision number.

  • vcs_mode: if 'r', the info is read from the VCS system but not written to (ex: the archival date) (optional, defaults to 'w')

  • help : The help information can either be a string that will be displayed with a Tk::Dialog or a pointer to a Pod file that will be displayed with a Tk::pod window.

    In case of pod information, the help hash must be like :

     {
       'class' => 'Your::Class',
       'section' => 'DECRIPTION' # optionnal
     }

EXAMPLE

Here's an example of a cumulated log :

 From pile_test v3.12:
   - coupled with tcapIncludes
   - does not compile in ANSI

 From pile_test v3.11:
 bugs fixed :

 - GREhp10971   :  TC_P_ABORT address format doesn't respect addr option.

AUTHOR

Dominique Dumont, Dominique_Dumont@grenoble.hp.com

Copyright (c) 1998-1999 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1)