[5129] | 1 | #!/usr/bin/perl |
---|
| 2 | # ------------------------------------------------------------------------------ |
---|
| 3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 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 | |
---|
| 21 | use strict; |
---|
| 22 | use warnings; |
---|
| 23 | |
---|
| 24 | use FindBin; |
---|
| 25 | use lib "$FindBin::Bin/../lib"; |
---|
| 26 | use FCM::Admin::System qw{ |
---|
| 27 | filter_projects |
---|
| 28 | get_projects_from_svn_backup |
---|
| 29 | recover_svn_repository |
---|
| 30 | }; |
---|
| 31 | use FCM::Admin::Util qw{option2config}; |
---|
| 32 | use Getopt::Long qw{GetOptions}; |
---|
| 33 | use Pod::Usage qw{pod2usage}; |
---|
| 34 | |
---|
| 35 | main(); |
---|
| 36 | |
---|
| 37 | sub 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 | |
---|
| 70 | fcm-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 | |
---|
| 82 | Prints help and exits. |
---|
| 83 | |
---|
| 84 | =item --no-recover-dumps |
---|
| 85 | |
---|
| 86 | If this option is specified, the program will not attempt to load the revision |
---|
| 87 | dumps of each repository after it has been restored from the backup. |
---|
| 88 | |
---|
| 89 | =item --no-recover-hooks |
---|
| 90 | |
---|
| 91 | If this option is specified, the program will not attempt to reinstate the hook |
---|
| 92 | scripts for each repository after it has been restored from the backup. |
---|
| 93 | |
---|
| 94 | =item --svn-backup-dir=DIR |
---|
| 95 | |
---|
| 96 | Specifies the root location of the backup directory. See |
---|
| 97 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 98 | |
---|
| 99 | =item --svn-dump-dir=DIR |
---|
| 100 | |
---|
| 101 | Specifies the root location of the directory where revision dumps are kept. See |
---|
| 102 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 103 | |
---|
| 104 | =item --svn-live-dir=DIR |
---|
| 105 | |
---|
| 106 | Specifies the root location of the live directory. See |
---|
| 107 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 108 | |
---|
| 109 | =item --svn-project-suffix=NAME |
---|
| 110 | |
---|
| 111 | Specifies the suffix added to the project name. See |
---|
| 112 | L<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 | |
---|
| 122 | Specifies one or more project to recover. If no project is specified, the |
---|
| 123 | program searches the backup directory for projects to recover. |
---|
| 124 | |
---|
| 125 | =back |
---|
| 126 | |
---|
| 127 | =head1 DESCRIPTION |
---|
| 128 | |
---|
| 129 | This program archives Subversion repositories in the live directory to the |
---|
| 130 | backup directory. |
---|
| 131 | |
---|
| 132 | =head1 COPYRIGHT |
---|
| 133 | |
---|
| 134 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 135 | |
---|
| 136 | =cut |
---|