Mentioned the improved keep-alive code.
[rsync/rsync.git] / support / cvs2includes
CommitLineData
1848fd6f
WD
1#!/usr/bin/perl
2#
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):
6#
7# -f ': .cvsinclude'
8#
9# (You could alternately put ": .cvsinclude" into an .rsync-filter file and
10# use the -F option, which is easier to type.)
11#
12# That ensures that all checked-in files/dirs are included in the transfer.
13#
14# The downside is that you need to remember to re-run cvs2includes whenever
15# You add a new file to the project.
16use strict;
17
18open(FIND, 'find . -name CVS -type d |') or die $!;
19while (<FIND>) {
20 chomp;
21 s#^\./##;
22
23 my $entries = "$_/Entries";
24 s/CVS$/.cvsinclude/;
25 my $filter = $_;
26
27 open(ENTRIES, $entries) or die "Unable to open $entries: $!\n";
28 my @includes;
29 while (<ENTRIES>) {
30 push(@includes, $1) if m#/(.+?)/#;
31 }
32 close ENTRIES;
33 if (@includes) {
34 open(FILTER, ">$filter") or die "Unable to write $filter: $!\n";
35 print FILTER '+ /', join("\n+ /", @includes), "\n";
36 close FILTER;
37 print "Updated $filter\n";
38 } elsif (-f $filter) {
39 unlink($filter);
40 print "Removed $filter\n";
41 }
42}
43close FIND;