#!/usr/bin/perl
# compare the contents of two commited versions of the project
#
require "prcs-parse.pl";
use Getopt::Long;
$ret=&GetOptions('r=s@',\@vers);
die "Argument format error" unless $ret;

if ( $#ARGV>=0 ) {
  $project=$ARGV[0];
  if ( $#vers == 1 ) { ($from, $to)=@vers; }  
  else { die "Must provide two version numbers"; }  
}
else {
  die "No project file present" unless ($project, $to)=&get_default_project;
  if ( $#vers == 1 ) { ($from, $to)=@vers; }
  elsif ( $#vers == 0 ) { ($from)=@vers; }
  else { die "Must provide at least one version number"; } 
}

%md_from=&md5sum_hash($project,$from);
%md_to=&md5sum_hash($project,$to);

system("prcs info -l -r $from $project");
print "\n";
system("prcs info -l -r $to $project");
print "\n";

print "Changes made from version ", $from, " to ", $to, "\n";
&compare(\%md_from, \%md_to);
