From: guido Date: Thu, 29 Nov 2001 08:31:58 +0000 (+0000) Subject: parser for cvs status X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9ad09126bb40cbae0a8354a3ae4eee7998ccb5c;p=dealii-svn.git parser for cvs status git-svn-id: https://svn.dealii.org/trunk@5298 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/common/scripts/status.pl b/deal.II/common/scripts/status.pl new file mode 100644 index 0000000000..2c922c4f21 --- /dev/null +++ b/deal.II/common/scripts/status.pl @@ -0,0 +1,78 @@ +$/ = 'File:'; + +my $compress = 0; +my $short = 0; +my $cvs_args = ''; +my $process_cvs_args = 0; +my $debug = 0; + +foreach (@ARGV) +{ + if ($process_cvs_args) + { + $cvs_args .= " $_"; + } + $compress = 1 if (m/-c/); + $short = 1 if (m/-s/); + $debug = 1 if (m/-d/); + $process_cvs_args = 1 if (m/^--$/); +} + +my $format = '(\S+)\s*Status: (.+)\s*Working revision:\s*(\S+)' + . '\s*Repository revision:\s*(\S+)\s*(\S+)' + . '\s*Sticky Tag:\s*(.+)' + . '\s*Sticky Date:\s*(.+)' + . '\s*Sticky Options:\s*(.+)' + ; + +print STDERR "cvs status $cvs_args |" if ($debug); +open CVS, "cvs status $cvs_args |"; + +while() +{ + next if (m/^\?/); + next if (m/^===================================================================/); + if (m/$format/) + { + my $file = $1; + my $status = $2; + my $work = $3; + my $rep = $4; + my $rep_file = $5; + my $tag = $6; + my $date = $7; + my $opt = $8; + + $rep_file =~ s!/home/people/cvs/deal/!!; + $rep_file =~ s!,v!!; + + if ($status eq 'Up-to-date') + { + $status = 'OK '; + } elsif ($status eq 'Needs Patch') + { + $status = "P $work<-$rep "; + } elsif ($status eq 'Locally Modified') + { + $status = "M $work->$rep "; + } else { + $status = "$status $work $rep "; + } + + $tag = '' if ($tag eq '(none)'); + $date = '' if ($date eq '(none)'); + $opt = '' if ($opt eq '(none)'); + my $stick = $tag . $date . $opt; + $stick = "Stick $stick" unless ($stick eq ''); + $status .= $stick; + printf "%-30s %-40s %s\n", $file, $status, + (($short) ? '' : $rep_file) + unless ($compress && ($status eq 'OK ')); + } + else + { + print STDERR "Ignored:\n$_\n", + "===================================================================\n" + if ($debug); + } +}