source: vendors/FCM-2017.10.0/sbin/fcm-recover-svn-repos @ 10672

Last change on this file since 10672 was 10672, checked in by nicolasmartin, 3 years ago

Reimport latest FCM release

File size: 3.4 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# (C) British Crown Copyright 2006-17 Met Office.
4#
5# This file is part of FCM, tools for managing and building source code.
6#
7# FCM is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# FCM is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with FCM. If not, see <http://www.gnu.org/licenses/>.
19# ------------------------------------------------------------------------------
20
21use strict;
22use warnings;
23
24use FindBin;
25use lib "$FindBin::Bin/../lib";
26use FCM::Admin::System qw{
27    filter_projects
28    get_projects_from_svn_backup
29    recover_svn_repository
30};
31use FCM::Admin::Util qw{option2config};
32use Getopt::Long qw{GetOptions};
33use Pod::Usage qw{pod2usage};
34
35main();
36
37sub main {
38    my %option;
39    my $result = GetOptions(
40        \%option,
41        q{help|usage|h},
42        q{no-recover-dumps},
43        q{no-recover-hooks},
44        q{svn-backup-dir=s},
45        q{svn-dump-dir=s},
46        q{svn-live-dir=s},
47        q{svn-project-suffix=s},
48    );
49    if (!$result) {
50        pod2usage(1);
51    }
52    if (exists($option{help})) {
53        pod2usage(q{-verbose} => 1);
54    }
55    option2config(\%option);
56    my @projects = filter_projects([get_projects_from_svn_backup()], \@ARGV);
57    for my $project (sort {$a->get_name() cmp $b->get_name()} @projects) {
58        recover_svn_repository(
59            $project,
60            !$option{q{no-recover-dumps}},
61            !$option{q{no-recover-hooks}},
62        );
63    }
64}
65
66__END__
67
68=head1 NAME
69
70fcm-recover-svn-repos
71
72=head1 SYNOPSIS
73
74    fcm-recover-svn-repos [OPTIONS] [PROJECT ...]
75
76=head1 OPTIONS
77
78=over 4
79
80=item --help, -h, --usage
81
82Prints help and exits.
83
84=item --no-recover-dumps
85
86If this option is specified, the program will not attempt to load the revision
87dumps of each repository after it has been restored from the backup.
88
89=item --no-recover-hooks
90
91If this option is specified, the program will not attempt to reinstate the hook
92scripts for each repository after it has been restored from the backup.
93
94=item --svn-backup-dir=DIR
95
96Specifies the root location of the backup directory. See
97L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
98
99=item --svn-dump-dir=DIR
100
101Specifies the root location of the directory where revision dumps are kept. See
102L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
103
104=item --svn-live-dir=DIR
105
106Specifies the root location of the live directory. See
107L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
108
109=item --svn-project-suffix=NAME
110
111Specifies the suffix added to the project name. See
112L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
113
114=back
115
116=head1 ARGUMENTS
117
118=over 4
119
120=item PROJECT
121
122Specifies one or more project to recover. If no project is specified, the
123program searches the backup directory for projects to recover.
124
125=back
126
127=head1 DESCRIPTION
128
129This program archives Subversion repositories in the live directory to the
130backup directory.
131
132=head1 COPYRIGHT
133
134E<169> Crown copyright Met Office. All rights reserved.
135
136=cut
Note: See TracBrowser for help on using the repository browser.