source: XIOS/tools/FCM/examples/sbin/fcm-recover-svn-repos @ 1520

Last change on this file since 1520 was 81, checked in by ymipsl, 12 years ago

ajout FCM 1.5

File size: 3.0 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# (C) Crown copyright Met Office. All rights reserved.
4# For further details please refer to the file COPYRIGHT.txt
5# which you should have received as part of this distribution.
6# ------------------------------------------------------------------------------
7
8use strict;
9use warnings;
10
11use FindBin;
12use lib "$FindBin::Bin/../lib";
13use FCM::Admin::System qw{
14    filter_projects
15    get_projects_from_svn_backup
16    recover_svn_repository
17};
18use FCM::Admin::Util qw{option2config};
19use Getopt::Long qw{GetOptions};
20use Pod::Usage qw{pod2usage};
21
22main();
23
24sub main {
25    my %option;
26    my $result = GetOptions(
27        \%option,
28        q{help|usage|h},
29        q{no-recover-dumps},
30        q{no-recover-hooks},
31        q{svn-backup-dir=s},
32        q{svn-dump-dir=s},
33        q{svn-hook-dir=s},
34        q{svn-live-dir=s},
35        q{svn-project-suffix=s},
36    );
37    if (!$result) {
38        pod2usage(1);
39    }
40    if (exists($option{help})) {
41        pod2usage(q{-verbose} => 1);
42    }
43    option2config(\%option);
44    my @projects = filter_projects([get_projects_from_svn_backup()], \@ARGV);
45    for my $project (@projects) {
46        recover_svn_repository(
47            $project,
48            !$option{q{no-recover-dumps}},
49            !$option{q{no-recover-hooks}},
50        );
51    }
52}
53
54__END__
55
56=head1 NAME
57
58fcm-recover-svn-repos
59
60=head1 SYNOPSIS
61
62    fcm-recover-svn-repos [OPTIONS] [PROJECT ...]
63
64=head1 OPTIONS
65
66=over 4
67
68=item --help, -h, --usage
69
70Prints help and exits.
71
72=item --no-recover-dumps
73
74If this option is specified, the program will not attempt to load the revision
75dumps of each repository after it has been restored from the backup.
76
77=item --no-recover-hooks
78
79If this option is specified, the program will not attempt to reinstate the hook
80scripts for each repository after it has been restored from the backup.
81
82=item --svn-backup-dir=DIR
83
84Specifies the root location of the backup directory. See
85L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
86
87=item --svn-dump-dir=DIR
88
89Specifies the root location of the directory where revision dumps are kept. See
90L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
91
92=item --svn-hook-dir=DIR
93
94Specifies the root location of the directory containing the source files of the
95hook scripts. See L<FCM::Admin::Config|FCM::Admin::Config> for the current
96default.
97
98=item --svn-live-dir=DIR
99
100Specifies the root location of the live directory. See
101L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
102
103=item --svn-project-suffix=NAME
104
105Specifies the suffix added to the project name. The default is "_svn".
106
107=back
108
109=head1 ARGUMENTS
110
111=over 4
112
113=item PROJECT
114
115Specifies one or more project to recover. If no project is specified, the
116program searches the backup directory for projects to recover.
117
118=back
119
120=head1 DESCRIPTION
121
122This program archives Subversion repositories in the live directory to the
123backup directory.
124
125=head1 COPYRIGHT
126
127E<169> Crown copyright Met Office. All rights reserved.
128
129=cut
Note: See TracBrowser for help on using the repository browser.