/[perl]/cvs-files.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /cvs-files.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Thu Sep 4 14:36:44 2003 UTC (20 years, 6 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
File MIME type: text/plain
use perl from /usr/bin

1 dpavlin 1.3 #!/usr/bin/perl -w
2 dpavlin 1.1
3     # Print all files which are in CVS repository. Obvious usage is to create
4 dpavlin 1.2 # archive of all files from repository which is full of other junk (this always
5     # happens to me :-)
6 dpavlin 1.1 #
7     # It will dump all find on STDOUT, just like "find . -type f -print"
8     # and dump some debugging output on STDERR
9     #
10     # 2003-08-06 Dobrica Pavlinusic <dpavlin@rot13.org>
11    
12     use English;
13     use strict;
14    
15     my @dirs = shift @ARGV || '.';
16    
17     sub read_entries {
18     my $dir = shift;
19     my @in_cvs;
20     if (open(E, "$dir/CVS/Entries")) {
21     while(<E>) {
22     chomp;
23     next if (m#^D#);
24     s#^/([^/]+)/.+/#$1#;
25     push @in_cvs,$_;
26     }
27     close(E);
28     }
29     return @in_cvs;
30     }
31    
32     while (@dirs) {
33     my $curr_dir=shift @dirs;
34     opendir(DIR,$curr_dir) || warn "opendir '$curr_dir': $!";
35     my @ignore = ('.', '..', 'CVS');
36     #print STDERR "ignore: ",join("|",@ignore),"\n";
37     my @in_cvs = read_entries($curr_dir);
38    
39     my @clutter = readdir(DIR);
40    
41     foreach my $file (@clutter) {
42     if (-d "$curr_dir/$file" && grep(/^\Q$file\E$/,@ignore) == 0 && -r "$curr_dir/$file") {
43     push @dirs,"$curr_dir/$file";
44     } else {
45     if (grep(/^\Q$file\E$/,@in_cvs) == 0) {
46     print STDERR "skip: $curr_dir/$file\n";
47     } else {
48     my $cvs_file = "$curr_dir/$file";
49     $cvs_file =~ s#^\./##;
50     $cvs_file =~ s#//#/#g;
51     print "$cvs_file\n";
52     }
53     }
54     }
55     }

  ViewVC Help
Powered by ViewVC 1.1.26