Menu

#5 CVS and Rcs base modules don't allow branching

open
nobody
None
5
2013-02-19
2003-08-25
Jon Gilbert
No

The packaged CVS and Rcs modules that come with
VCS 0.10 (dated Feb 05 2003) don't allow for branching.
In point of fact, there are two main areas where this
is impossible:

In Rcs/File.pm:

$ diff File.pm ~lib/perl5/site_perl/5.6.1/VCS/Rcs/File.pm
4a5,6
> use vars qw( %LOG_CACHE );
>
30,32c32,38
< map {
<
VCS::Rcs::Version->new("$self->{URL}/$rev_head.$_")
< } (1..$rev_tail);
---
> my @ary = ();
> foreach my $line (split(/[\n\r]/,
$VCS::Rcs::LOG_CACHE{ $self->{URL} })) {
> if ($line =~ /^revision\s+([\d.]+)/) {
> push @ary,
VCS::Rcs::Version->new("$self->{URL}/$1");
> }
> }
> @ary;

It's neat that you're trying to keep yourself from
recalculating all the available versions, but look -
you've already done most of the work and saved it in
%VCS::Rcs::LOG_CACHE.

In Rcs.pm:

$ diff Rcs.pm ~/lib/perl5/site_perl/5.6.1/VCS/Rcs.pm
44a45,50
> if ($reason[0] =~ /^branches:\s+/) {
> my($branch, $b_revs) = split(/:\s+/, shift
@reason);
> @{ $info{'branches'} } = split(/;\s*/, $b_revs);
> } else {
> @{$info{'branches'}} = ();
> }

This gives you correct parsing of the 'message', or
'reason' block of text in the output of rlog (there's
actually 3 lines of info - the revision, the
date/author/state line, the branch data - before the
revision log), as well as putting any branches into the
%info hash before returning it from _parse_log_rev().

Additionally, you'll probably want to touch
Rcs/Version.pm, to get a branches() method:

75a76,79
> sub branches {
> join "\n", @{shift->_boiler_plate_info('branches')};
> }

...or something to that effect.

These edits can probably be applied to the CVS methods
as well, although at this point I've not yet tried it.

Discussion


Log in to post a comment.