]> https://gitweb.dealii.org/ - dealii.git/commitdiff
parser for cvs status
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 29 Nov 2001 08:31:58 +0000 (08:31 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 29 Nov 2001 08:31:58 +0000 (08:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@5298 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/scripts/status.pl [new file with mode: 0644]

diff --git a/deal.II/common/scripts/status.pl b/deal.II/common/scripts/status.pl
new file mode 100644 (file)
index 0000000..2c922c4
--- /dev/null
@@ -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(<CVS>)
+{
+    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);
+    }
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.