Commit | Line | Data |
---|---|---|
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 | # | |
339eb894 | 9 | # That ensures that all checked-in files/dirs are included in the transfer. |
1848fd6f WD |
10 | # (You could alternately put ": .cvsinclude" into an .rsync-filter file and |
11 | # use the -F option, which is easier to type.) | |
12 | # | |
1848fd6f WD |
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; | |
16 | ||
17 | open(FIND, 'find . -name CVS -type d |') or die $!; | |
18 | while (<FIND>) { | |
19 | chomp; | |
20 | s#^\./##; | |
21 | ||
22 | my $entries = "$_/Entries"; | |
23 | s/CVS$/.cvsinclude/; | |
24 | my $filter = $_; | |
25 | ||
26 | open(ENTRIES, $entries) or die "Unable to open $entries: $!\n"; | |
27 | my @includes; | |
28 | while (<ENTRIES>) { | |
29 | push(@includes, $1) if m#/(.+?)/#; | |
30 | } | |
31 | close ENTRIES; | |
32 | if (@includes) { | |
33 | open(FILTER, ">$filter") or die "Unable to write $filter: $!\n"; | |
34 | print FILTER '+ /', join("\n+ /", @includes), "\n"; | |
35 | close FILTER; | |
36 | print "Updated $filter\n"; | |
37 | } elsif (-f $filter) { | |
38 | unlink($filter); | |
39 | print "Removed $filter\n"; | |
40 | } | |
41 | } | |
42 | close FIND; |