15 sa [options] [status|update|checkout] [directories to sync]
18 --quick, -Q don't update external projects
20 --debug, -d debugging level (Default 0)
21 --help, -h display this help
22 --man, -m display manual
30 Debug verbosity. (Default 0)
34 Display brief useage information.
52 my %options = (quick => 1,
59 GetOptions(\%options,'quick|Q+','quiet|q!','debug|d+','help|h|?','man|m');
61 pod2usage() if $options{help};
62 pod2usage({verbose=>2}) if $options{man};
64 # parse configuration file
68 Reads configuration information from Start by parsing /etc/sa.conf,
69 then ~/.sarc then ~/.sarc_$hostname, then ~/.sarc_local
71 The configuration file contains a list of svn repositories which
72 should be queried; each line can contain a tab, which indicates that
73 the command following the tab should be run fater the svn directory is
76 The configuration files are read in the order given above.
80 sub parse_config_file {
81 my ($repos,$filename,$home) = @_;
82 return unless -e $filename and -r _;
83 my $fh = new IO::File $filename, 'r' or die "Unable to read configuration file $filename $!";
87 my ($repo,$command) = split /\t/,$_,2;
88 $repo =~ s/^\~/$home/;
89 $$repos{$repo} = $command;
95 my $HOSTNAME=qx(hostname);
97 my $CAN_IGNORE_EXTERNALS = 0;
98 qx(svn --version) =~ /\(r(\d+)\)/;
100 $CAN_IGNORE_EXTERNALS = 1;
104 for ('/etc/sa.conf', "${HOME}/.sarc", "${HOME}/.sarc_${HOSTNAME}", "${HOME}/.sarc_local") {
106 parse_config_file(\%repos,$_,$HOME);
110 $DEBUG = $options{debug};
114 if (@ARGV and $ARGV[0] =~ /^(st(?:atus)?|up(?:date)?|checkout)$/) {
121 while (my ($repo,$run_after) = each(%repos)) {
122 if (-e "$repo/.svn") {
125 $options{quiet}?'-q':(),
126 ($options{quick} and $CAN_IGNORE_EXTERNALS)?'--ignore-externals':(),
127 $options{quick}>1?'-N':(),
131 if ($command =~ /^up(?:date)|checkout$/) {
132 system($run_after,$repo) if defined $run_after and length $run_after;