| Apache-CVS documentation | Contained in the Apache-CVS distribution. |
Apache::CVS::Diff - class that implements a CVS diff
use Apache::CVS::File();
use Apache::CVS::Diff();
$diff = Apache::CVS::Diff->new($source, $target, $style);
@content = @{ $diff->content() };
The Apache::CVS::Diff class implements a CVS diff. What you would get with
your plain 'ol cvs diff command.
Construct a new Apache::CVS::Diff object. The first two arguments should be
instancesof Apache::CVS::Version. The third is the arguments to rcsdiff(1).
The style defaults to 'ua'.
Returns the source revision of this diff.
Returns the target revision of this diff.
Returns or set the style of the diff.
Returns the contents of the diff as a references to an array of lines.
John Barbee <barbee@veribox.net>
Copyright 2001-2002 John Barbee
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Apache-CVS documentation | Contained in the Apache-CVS distribution. |
# $Id: Diff.pm,v 1.2 2002/04/23 04:18:28 barbee Exp $
package Apache::CVS::Diff; use strict; $Apache::CVS::Diff::VERSION = $Apache::CVS::VERSION;;
sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{source} = shift; $self->{target} = shift; $self->{style} = shift; $self->{default_style} = shift; $self->{content} = undef; bless ($self, $class); return $self; }
sub source { my $self = shift; return $self->{source}; }
sub target { my $self = shift; return $self->{target}; } sub load { my $self = shift; my @content; eval { @content = $self->source()->rcs()->rcsdiff('-' . $self->style() . ' -r' . $self->source()->number(), '-r' . $self->target()->number()); }; if ($@) { die 'Apache::CVS::Diff ' . $@; } $self->content(\@content); }
sub style { my $self = shift; $self->{style} = shift if scalar @_; $self->{style} = 'ua' unless $self->{style}; return $self->{style}; }
sub content { my $self = shift; $self->{content} = shift if scalar @_; $self->load() unless $self->{content}; return $self->{content}; }
1;