Skip to content
Snippets Groups Projects
Commit 3606734f authored by Karl Fogel's avatar Karl Fogel
Browse files

Ooops, fixed the filename-resetting bug.

Added undocumented --debug flag and the debug() routine.
parent 52dd29c0
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,9 @@ $Version =~ s/\S+\s+(\S+)\s+\S+/$1/;
## Vars set by options:
# Print debugging messages?
my $Debug = 0;
# Just show version and exit?
my $Print_Version = 0;
......@@ -143,7 +146,7 @@ sub derive_change_log ()
my %grand_poobah;
my $file_name = "";
my $file_full_path = "";
my $date = "";
my $author = "";
my $msg_txt = "";
......@@ -159,16 +162,16 @@ sub derive_change_log ()
while (<LOG_SOURCE>)
{
# If on a new file and encounter the filename, grab it:
if ((! $file_name) && (! $date) && (! $author) && (! $msg_txt)
if ((! $file_full_path) && (! $date) && (! $author) && (! $msg_txt)
&& /^Working file: (.*)/)
{
$file_name = $1;
$file_full_path = $1;
next;
}
# If have file name but not date or author, and see date or
# author, then grab them:
if ($file_name && (! $date) && (! $author) && /^date: .*/) {
if ($file_full_path && (! $date) && (! $author) && /^date: .*/) {
($date, $author) = &parse_date_and_author ($_);
next;
}
......@@ -180,7 +183,7 @@ sub derive_change_log ()
# If have file name, date, and author, then we're just grabbing
# log message texts:
if ($file_name && $date && $author)
if ($file_full_path && $date && $author)
{
unless (/^$logmsg_separator/ || /^$file_separator/)
{
......@@ -213,12 +216,14 @@ sub derive_change_log ()
$date_author_text .= "\n$msg_txt";
my $dir_key; # key into %grand_poobah
my $fname; # the file name we record under
my $ignore_me; # why are you reading this?
if ($Distributed) {
($file_name, $dir_key, $ignore_me) = fileparse ($file_name);
($fname, $dir_key, $ignore_me) = fileparse ($file_full_path);
}
else {
$dir_key = "./"; # just use current directory
$dir_key = "./";
$fname = $file_full_path;
}
## Get the appropriate directory subhash
......@@ -241,7 +246,8 @@ sub derive_change_log ()
}
# Add this file to the list
push (@$files_reffy, ($file_name));
debug ("pushing msg for $dir_key, $fname\n");
push (@$files_reffy, ($fname));
# Stuff everyone back into the glove compartment
$subhash{$date_author_text} = $files_reffy;
......@@ -256,7 +262,7 @@ sub derive_change_log ()
# Maybe even make way for the next file:
if (/^$file_separator/) {
$file_name = "";
$file_full_path = "";
}
}
next;
......@@ -269,6 +275,8 @@ sub derive_change_log ()
foreach my $dir (keys (%grand_poobah))
{
debug ("DOING DIR: $dir\n");
my $tmpfile = "${dir}${Log_File_Name}.cvs2cl$$.tmp";
my $logfile_here = "${dir}${Log_File_Name}";
my $logfile_bak = "${dir}.${Log_File_Name}.bak";
......@@ -294,6 +302,8 @@ sub derive_change_log ()
my $files = &pretty_file_list ($filesref);
$text = &pretty_msg_text ($text);
debug (" DOING $dir FILES: $files\n");
# See page 512 of Perl Programming, 2nd Edition, about "wrap()":
print LOG_OUT "$date_author\n";
print LOG_OUT "\n";
......@@ -387,6 +397,9 @@ sub parse_options ()
if ($arg =~ /^-h$|^-help$|^--help$|^--usage$|^-?$/) {
$Print_Usage = 1;
}
elsif ($arg =~ /^--debug$/) { # unadvertised option, heh
$Debug = 1;
}
elsif ($arg =~ /^--version$/) {
$Print_Version = 1;
}
......@@ -456,6 +469,15 @@ sub parse_options ()
}
sub debug ()
{
if ($Debug) {
my $msg = shift;
print STDERR "${msg}";
}
}
sub version ()
{
print "cvs2pl.cl version ${Version}; distributed under the GNU GPL.\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment