1294 |
14 Nov 10 |
peter |
// $Id$ |
1294 |
14 Nov 10 |
peter |
2 |
|
1294 |
14 Nov 10 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010, 2012, 2023 Peter Johansson |
1294 |
14 Nov 10 |
peter |
5 |
|
1294 |
14 Nov 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1294 |
14 Nov 10 |
peter |
7 |
|
1294 |
14 Nov 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1294 |
14 Nov 10 |
peter |
under the terms of the GNU General Public License as published by |
1294 |
14 Nov 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1294 |
14 Nov 10 |
peter |
(at your option) any later version. |
1294 |
14 Nov 10 |
peter |
12 |
|
1294 |
14 Nov 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1294 |
14 Nov 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1294 |
14 Nov 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1294 |
14 Nov 10 |
peter |
General Public License for more details. |
1294 |
14 Nov 10 |
peter |
17 |
|
1294 |
14 Nov 10 |
peter |
You should have received a copy of the GNU General Public License |
1294 |
14 Nov 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1294 |
14 Nov 10 |
peter |
20 |
*/ |
1294 |
14 Nov 10 |
peter |
21 |
|
1619 |
12 Mar 23 |
peter |
22 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
23 |
|
1294 |
14 Nov 10 |
peter |
24 |
#include "svndigest_copy_cacheParameter.h" |
1294 |
14 Nov 10 |
peter |
25 |
|
1294 |
14 Nov 10 |
peter |
26 |
#include "lib/CacheCopyer.h" |
1294 |
14 Nov 10 |
peter |
27 |
#include "lib/Directory.h" |
1321 |
28 Nov 10 |
peter |
28 |
#include "lib/utility.h" |
1294 |
14 Nov 10 |
peter |
29 |
|
1294 |
14 Nov 10 |
peter |
30 |
#include "yat/Exception.h" |
1294 |
14 Nov 10 |
peter |
31 |
#include "yat/OptionArg.h" |
1294 |
14 Nov 10 |
peter |
32 |
|
1294 |
14 Nov 10 |
peter |
33 |
#include <iostream> |
1294 |
14 Nov 10 |
peter |
34 |
|
1294 |
14 Nov 10 |
peter |
35 |
using namespace theplu; |
1294 |
14 Nov 10 |
peter |
36 |
using namespace svndigest; |
1294 |
14 Nov 10 |
peter |
37 |
int main( int argc, char* argv[]) |
1294 |
14 Nov 10 |
peter |
38 |
{ |
1294 |
14 Nov 10 |
peter |
// Reading commandline options |
1294 |
14 Nov 10 |
peter |
40 |
svndigest_copy_cacheParameter option; |
1294 |
14 Nov 10 |
peter |
41 |
try { |
1294 |
14 Nov 10 |
peter |
42 |
option.parse(argc,argv); |
1294 |
14 Nov 10 |
peter |
43 |
if (option.verbose()) |
1294 |
14 Nov 10 |
peter |
44 |
std::cout << "Done parsing parameters" << std::endl; |
1294 |
14 Nov 10 |
peter |
45 |
} |
1294 |
14 Nov 10 |
peter |
46 |
catch (yat::utility::cmd_error& e) { |
1294 |
14 Nov 10 |
peter |
47 |
std::cerr << e.what() << std::endl; |
1294 |
14 Nov 10 |
peter |
48 |
exit(EXIT_FAILURE); |
1294 |
14 Nov 10 |
peter |
49 |
} |
1294 |
14 Nov 10 |
peter |
50 |
catch (std::runtime_error& e) { |
1294 |
14 Nov 10 |
peter |
51 |
std::cerr << "svndigest-copy-cache: " << e.what() << std::endl; |
1294 |
14 Nov 10 |
peter |
52 |
return EXIT_FAILURE; |
1294 |
14 Nov 10 |
peter |
53 |
} |
1294 |
14 Nov 10 |
peter |
54 |
|
1294 |
14 Nov 10 |
peter |
55 |
try { |
1294 |
14 Nov 10 |
peter |
56 |
if (option.verbose()) |
1294 |
14 Nov 10 |
peter |
57 |
std::cout << "Initializing SVN singleton." << std::endl; |
1294 |
14 Nov 10 |
peter |
58 |
SVN::instance(option.root()); |
1294 |
14 Nov 10 |
peter |
59 |
|
1294 |
14 Nov 10 |
peter |
60 |
Directory tree(0, option.root(), "", option.root_basename()); |
1294 |
14 Nov 10 |
peter |
61 |
|
1294 |
14 Nov 10 |
peter |
62 |
chdir(option.root()); |
1294 |
14 Nov 10 |
peter |
63 |
CacheCopyer copyer(option.target(), option.verbose()); |
1294 |
14 Nov 10 |
peter |
64 |
tree.traverse(copyer); |
1294 |
14 Nov 10 |
peter |
65 |
} |
1294 |
14 Nov 10 |
peter |
66 |
catch (std::runtime_error& e) { |
1507 |
31 Aug 12 |
peter |
67 |
std::cerr << "svndigest-copy-cache: " << e.what() << "\n"; |
1294 |
14 Nov 10 |
peter |
68 |
return EXIT_FAILURE; |
1294 |
14 Nov 10 |
peter |
69 |
} |
1294 |
14 Nov 10 |
peter |
70 |
|
1294 |
14 Nov 10 |
peter |
71 |
return EXIT_SUCCESS; // normal exit |
1294 |
14 Nov 10 |
peter |
72 |
} |