Mention smart-make in a comment.
[rsync.git] / support / cvs2includes
blobfc7f78fb8fb5373394237a405a0371997aa5fb81
1 #!/usr/bin/env perl
3 # This script finds all CVS/Entries files in the current directory and below
4 # and creates a local .cvsinclude file with non-inherited rules including each
5 # checked-in file. Then, use this option whenever using --cvs-exclude (-C):
7 # -f ': .cvsinclude'
9 # That ensures that all checked-in files/dirs are included in the transfer.
10 # (You could alternately put ": .cvsinclude" into an .rsync-filter file and
11 # use the -F option, which is easier to type.)
13 # The downside is that you need to remember to re-run cvs2includes whenever
14 # you add a new file to the project.
15 use strict;
17 open(FIND, 'find . -name CVS -type d |') or die $!;
18 while (<FIND>) {
19 chomp;
20 s#^\./##;
22 my $entries = "$_/Entries";
23 s/CVS$/.cvsinclude/;
24 my $filter = $_;
26 open(ENTRIES, $entries) or die "Unable to open $entries: $!\n";
27 my @includes;
28 while (<ENTRIES>) {
29 push(@includes, $1) if m#/(.+?)/#;
31 close ENTRIES;
32 if (@includes) {
33 open(FILTER, ">$filter") or die "Unable to write $filter: $!\n";
34 print FILTER map "+ /$_\n", @includes;
35 close FILTER;
36 print "Updated $filter\n";
37 } elsif (-f $filter) {
38 unlink($filter);
39 print "Removed $filter\n";
42 close FIND;