summaryrefslogtreecommitdiffstats
path: root/scripts/noncvslist
blob: 5b118a363a0fc60b940ba03173f2c6ff98fbe230 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /usr/bin/env perl

# Offline check for extra in a checked-out
# CVS module. Sirtaj Singh Kang <taj@kde.org> May 2000.
# Usage:
# 	noncvsfiles <module dir>...

@dirqueue = @ARGV;
%entries = ();
@files = ();

sub processEntries
{
	my ( $dir ) = @_;

	open( ENTRIES, $dir."/CVS/Entries" ) 
		|| warn "Couldn't read '$dir/CVS/Entries'";

	while( <ENTRIES> ) {
		if ( m#^\s*D/([^/]+)/# ) {
			push ( @dirqueue, "$dir/$1" );
			$entries{ "$dir/$1" } = 1;
			next;
		}

		next unless m#^\s*/([^/]+)/([\d\.]*)/([^/]+)/#;

		$fname = $1;
		$ver = $2;
		$stamp = $3;

		$entries{ "$dir/$fname" } = $stamp;
	}

	close( ENTRIES );

        open( IGNORE, $dir."/.cvsignore" ) || return;

        while( <IGNORE> ) {
                chomp;
                s/^\s+//;
                s/\s+$//;
                $entries{ "$dir/$_" } = "ignored";
        }

        close( IGNORE );
}

# month assoc array for name -> index lookups
$mctr = 0;

foreach $month ( @monthlist ) {
	$months{ $month } = $mctr;
	$mctr++;
}

# Try current directory if none specified

if( $#dirqueue < 0 ) {
	push( @dirqueue, "." );
}

# process directory queue, filling entries hash
foreach $dir ( @dirqueue ) {
	processEntries( $dir );

	open( FILES, 'find "'.$dir.'" | grep -v "/CVS"|' )
			|| die "Couldn't find files in $dir";

	while( <FILES> ) {
		chop;
		next if $_ eq '.';
		next if m/\/\.#/;     #ignore .#blah
		push @files, $_;
	}
}

#foreach my $entry ( sort keys %entries ) 
#{
#	print $entry,"\n";
#}

my $lastfile = "";

foreach my $file ( sort @files ) 
{
	next if $file eq $lastfile;
	$lastfile = $file;

	if ( !exists $entries{ $file } ) {
		print $file,"\n";
	}
}

=head1 NAME

noncvslist -- List all files in a checked out CVS module that are not
known by the CVS server.

=head1 SYNOPSIS

When the current directory is a CVS module:
 
        noncvslist
 
Checking checked out subdirectories:
 
        noncvslist [<dir>...]

=head1 DESCRIPTION

This script will list all files and directories in the module(s) that are 
not listed in the CVS/Entries files. These may be files created during builds,
new un-added sources files etc. It is a useful housekeeping tool.

=head1 EXAMPLES

Assuming baseline/ has tdelibs/ and tdebase/ checked out within it:

	cd baseline/tdelibs; noncvslist
	cd baseline; noncvslist tdelibs tdebase

=head1 AUTHOR

Sirtaj Singh Kang <taj@kde.org>

=cut