1055 |
21 Apr 10 |
peter |
// $Id$ |
1055 |
21 Apr 10 |
peter |
2 |
|
1055 |
21 Apr 10 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010, 2011, 2023 Peter Johansson |
1055 |
21 Apr 10 |
peter |
5 |
|
1055 |
21 Apr 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1055 |
21 Apr 10 |
peter |
7 |
|
1055 |
21 Apr 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1055 |
21 Apr 10 |
peter |
under the terms of the GNU General Public License as published by |
1055 |
21 Apr 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1055 |
21 Apr 10 |
peter |
(at your option) any later version. |
1055 |
21 Apr 10 |
peter |
12 |
|
1055 |
21 Apr 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1055 |
21 Apr 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1055 |
21 Apr 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1055 |
21 Apr 10 |
peter |
General Public License for more details. |
1055 |
21 Apr 10 |
peter |
17 |
|
1055 |
21 Apr 10 |
peter |
You should have received a copy of the GNU General Public License |
1055 |
21 Apr 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1055 |
21 Apr 10 |
peter |
20 |
*/ |
1055 |
21 Apr 10 |
peter |
21 |
|
1619 |
12 Mar 23 |
peter |
22 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
23 |
|
1060 |
02 Jun 10 |
peter |
24 |
#include "svncopyrightParameter.h" |
1055 |
21 Apr 10 |
peter |
25 |
|
1423 |
16 Dec 11 |
peter |
26 |
#include "lib/CacheRemover.h" |
1119 |
04 Jul 10 |
peter |
27 |
#include "lib/Configuration.h" |
1119 |
04 Jul 10 |
peter |
28 |
#include "lib/Directory.h" |
1119 |
04 Jul 10 |
peter |
29 |
#include "lib/main_utility.h" |
1067 |
06 Jun 10 |
peter |
30 |
|
1055 |
21 Apr 10 |
peter |
31 |
#include <iostream> |
1055 |
21 Apr 10 |
peter |
32 |
#include <string> |
1055 |
21 Apr 10 |
peter |
33 |
|
1055 |
21 Apr 10 |
peter |
34 |
int main( int argc, char* argv[]) |
1055 |
21 Apr 10 |
peter |
35 |
{ |
1055 |
21 Apr 10 |
peter |
36 |
using namespace theplu; |
1055 |
21 Apr 10 |
peter |
37 |
using namespace svndigest; |
1055 |
21 Apr 10 |
peter |
38 |
|
1055 |
21 Apr 10 |
peter |
// Reading commandline options |
1060 |
02 Jun 10 |
peter |
40 |
svncopyrightParameter option; |
1055 |
21 Apr 10 |
peter |
41 |
try { |
1060 |
02 Jun 10 |
peter |
42 |
option.parse(argc, argv); |
1060 |
02 Jun 10 |
peter |
43 |
if (option.verbose()) |
1055 |
21 Apr 10 |
peter |
44 |
std::cout << "Done parsing parameters" << std::endl; |
1055 |
21 Apr 10 |
peter |
45 |
} |
1055 |
21 Apr 10 |
peter |
46 |
catch (yat::utility::cmd_error& e) { |
1055 |
21 Apr 10 |
peter |
47 |
std::cerr << e.what() << std::endl; |
1055 |
21 Apr 10 |
peter |
48 |
return EXIT_FAILURE; |
1055 |
21 Apr 10 |
peter |
49 |
} |
1085 |
12 Jun 10 |
peter |
50 |
catch (std::runtime_error& e) { |
1086 |
12 Jun 10 |
peter |
51 |
std::cerr << "svncopyright: " << e.what() << std::endl; |
1085 |
12 Jun 10 |
peter |
52 |
return EXIT_FAILURE; |
1085 |
12 Jun 10 |
peter |
53 |
} |
1067 |
06 Jun 10 |
peter |
54 |
|
1067 |
06 Jun 10 |
peter |
55 |
try { |
1102 |
15 Jun 10 |
peter |
56 |
load_config(option.config_file(), option.verbose()); |
1070 |
06 Jun 10 |
peter |
57 |
if (option.generate_config()) { |
1070 |
06 Jun 10 |
peter |
58 |
std::cout << Configuration::instance(); |
1070 |
06 Jun 10 |
peter |
59 |
return EXIT_SUCCESS; |
1070 |
06 Jun 10 |
peter |
60 |
} |
1072 |
06 Jun 10 |
peter |
61 |
|
1072 |
06 Jun 10 |
peter |
62 |
if (option.verbose()) |
1072 |
06 Jun 10 |
peter |
63 |
std::cout << "Initializing SVN singleton." << std::endl; |
1072 |
06 Jun 10 |
peter |
64 |
SVN::instance(option.root()); |
1086 |
12 Jun 10 |
peter |
65 |
|
1086 |
12 Jun 10 |
peter |
// build directory tree already here ... see comment in svndigest.cc |
1086 |
12 Jun 10 |
peter |
67 |
if (option.verbose()) |
1086 |
12 Jun 10 |
peter |
68 |
std::cout << "Building directory tree" << std::endl; |
1264 |
02 Nov 10 |
peter |
69 |
Directory tree(0,option.root(),"",option.root_basename()); |
1086 |
12 Jun 10 |
peter |
70 |
|
1234 |
23 Oct 10 |
peter |
71 |
update_copyright(tree, option.verbose(), option.ignore_cache()); |
1423 |
16 Dec 11 |
peter |
72 |
CacheRemover cache_remover(option.verbose(), ".svncopyright-cache"); |
1423 |
16 Dec 11 |
peter |
73 |
tree.traverse(cache_remover); |
1067 |
06 Jun 10 |
peter |
74 |
} |
1067 |
06 Jun 10 |
peter |
75 |
catch (std::runtime_error& e) { |
1067 |
06 Jun 10 |
peter |
76 |
std::cerr << "svncopyright: " << e.what() << "\n"; |
1067 |
06 Jun 10 |
peter |
77 |
return EXIT_FAILURE; |
1067 |
06 Jun 10 |
peter |
78 |
} |
1067 |
06 Jun 10 |
peter |
79 |
|
1055 |
21 Apr 10 |
peter |
80 |
return EXIT_SUCCESS; // normal exit |
1055 |
21 Apr 10 |
peter |
81 |
} |