summaryrefslogtreecommitdiff
path: root/lib/sbin/CVSStatus.pl
blob: 5d4907a5d43c38d6d6acbe40f330bf425b3ee88a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#/*@@
#  @file      CVSStatus.pl
#  @date      Mon Mar  6 01:20:01 CET 2000
#  @author    Gabrielle Allen
#  @desc
#     Processes output from cvs status and gives better messages
#     Original version by Paul Walker
#     $Header$
#  @enddesc
#@@*/

use IO::Handle;
STDOUT->autoflush(1);

&writeheader();

$full = 0;

open (CS, "cvs status 2>&1 |");
$gotone = 0;

while (<CS>) {

    if (m/============/ || m/Examining/) {
	if ($gotone) {
	  $module =~ m:^\s*(/\w*/\w*):;
	  $module = $1;
          if ($module ne $module_old) {
            print "\nRepository: $module\n";$module_old=$module;
          }
	  # Get differences between versions
          if ($case =~ /diff/i)
	  {
	    print "\n\n*******************************************************************\n\ncvs diff -u -r $rversion $dir/$file\n\n";
	    write;
	    print "\n\n";
	    open (DIFF, "cvs diff -u -r $rversion $dir/$file |");
	    while (<DIFF>) {print;}
	  }
	  else
	  {
	    write;
	  }
	}
	$gotone = 0;
	$module="";
	$file = "";
	$status = "";
	$version="";
	$rversion="";
    }
    if (m/File: (\S+)/) {$file = $1;}
    if (m/Status: (.+)\s/) {
	$status = $1;
	if (!($status =~ m/Up-to-date/)) {
	    $gotone = 1;
	}
    }
    if (m/Examining\s*(\S+)\s*$/) {$dir = $1;}
    if (m/Working revision:\s*(\S+)\s/) {$version = $1;}
    if (m/Repository revision:\s*(\S+)\s+(\S+)/) {
	$rversion = $1; $module = $2;
    }

}
exit;

format STDOUT =
   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   @<<<<<<<<<<<<<<< @<<<<<<<</@<<<<<<<<
substr("$dir/$file", -37), $status, $version, $rversion
.


sub writeheader
{
my ($case) = @_;

print "$case\n";
if ($case =~ /diff/)
{
print <<EOF;

CVS Diff report

File                                       Status           Local   /Remote ver
-------------------------------------------------------------------------------
EOF
}
else
{
print <<EOF;

CVS Status report

File                                       Status           Local   /Remote ver
-------------------------------------------------------------------------------
EOF
}
}