Annotation of embedaddon/rsync/support/cvs2includes, revision 1.1.1.2
1.1.1.2 ! misho 1: #!/usr/bin/env perl
1.1 misho 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: # 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.)
12: #
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 map "+ /$_\n", @includes;
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;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>