[1980] | 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 | |
---|
| 8 | use strict; |
---|
| 9 | use warnings; |
---|
| 10 | |
---|
| 11 | use FindBin; |
---|
| 12 | use lib "$FindBin::Bin/../lib"; |
---|
| 13 | use FCM::Admin::System qw{ |
---|
| 14 | filter_projects |
---|
| 15 | get_projects_from_svn_backup |
---|
| 16 | recover_svn_repository |
---|
| 17 | }; |
---|
| 18 | use FCM::Admin::Util qw{option2config}; |
---|
| 19 | use Getopt::Long qw{GetOptions}; |
---|
| 20 | use Pod::Usage qw{pod2usage}; |
---|
| 21 | |
---|
| 22 | main(); |
---|
| 23 | |
---|
| 24 | sub 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 | |
---|
| 58 | fcm-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 | |
---|
| 70 | Prints help and exits. |
---|
| 71 | |
---|
| 72 | =item --no-recover-dumps |
---|
| 73 | |
---|
| 74 | If this option is specified, the program will not attempt to load the revision |
---|
| 75 | dumps of each repository after it has been restored from the backup. |
---|
| 76 | |
---|
| 77 | =item --no-recover-hooks |
---|
| 78 | |
---|
| 79 | If this option is specified, the program will not attempt to reinstate the hook |
---|
| 80 | scripts for each repository after it has been restored from the backup. |
---|
| 81 | |
---|
| 82 | =item --svn-backup-dir=DIR |
---|
| 83 | |
---|
| 84 | Specifies the root location of the backup directory. See |
---|
| 85 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 86 | |
---|
| 87 | =item --svn-dump-dir=DIR |
---|
| 88 | |
---|
| 89 | Specifies the root location of the directory where revision dumps are kept. See |
---|
| 90 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 91 | |
---|
| 92 | =item --svn-hook-dir=DIR |
---|
| 93 | |
---|
| 94 | Specifies the root location of the directory containing the source files of the |
---|
| 95 | hook scripts. See L<FCM::Admin::Config|FCM::Admin::Config> for the current |
---|
| 96 | default. |
---|
| 97 | |
---|
| 98 | =item --svn-live-dir=DIR |
---|
| 99 | |
---|
| 100 | Specifies the root location of the live directory. See |
---|
| 101 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 102 | |
---|
| 103 | =item --svn-project-suffix=NAME |
---|
| 104 | |
---|
| 105 | Specifies 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 | |
---|
| 115 | Specifies one or more project to recover. If no project is specified, the |
---|
| 116 | program searches the backup directory for projects to recover. |
---|
| 117 | |
---|
| 118 | =back |
---|
| 119 | |
---|
| 120 | =head1 DESCRIPTION |
---|
| 121 | |
---|
| 122 | This program archives Subversion repositories in the live directory to the |
---|
| 123 | backup directory. |
---|
| 124 | |
---|
| 125 | =head1 COPYRIGHT |
---|
| 126 | |
---|
| 127 | E<169> Crown copyright Met Office. All rights reserved. |
---|
| 128 | |
---|
| 129 | =cut |
---|