1230 |
18 Oct 10 |
peter |
// $Id$ |
1230 |
18 Oct 10 |
peter |
2 |
|
1230 |
18 Oct 10 |
peter |
3 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2010, 2011, 2012, 2023 Peter Johansson |
1230 |
18 Oct 10 |
peter |
5 |
|
1230 |
18 Oct 10 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1230 |
18 Oct 10 |
peter |
7 |
|
1230 |
18 Oct 10 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
1230 |
18 Oct 10 |
peter |
under the terms of the GNU General Public License as published by |
1230 |
18 Oct 10 |
peter |
the Free Software Foundation; either version 3 of the License, or |
1230 |
18 Oct 10 |
peter |
(at your option) any later version. |
1230 |
18 Oct 10 |
peter |
12 |
|
1230 |
18 Oct 10 |
peter |
svndigest is distributed in the hope that it will be useful, but |
1230 |
18 Oct 10 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
1230 |
18 Oct 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1230 |
18 Oct 10 |
peter |
General Public License for more details. |
1230 |
18 Oct 10 |
peter |
17 |
|
1230 |
18 Oct 10 |
peter |
You should have received a copy of the GNU General Public License |
1230 |
18 Oct 10 |
peter |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1230 |
18 Oct 10 |
peter |
20 |
*/ |
1230 |
18 Oct 10 |
peter |
21 |
|
1619 |
12 Mar 23 |
peter |
22 |
#include <config.h> |
1619 |
12 Mar 23 |
peter |
23 |
|
1230 |
18 Oct 10 |
peter |
24 |
#include "SvndigestVisitor.h" |
1230 |
18 Oct 10 |
peter |
25 |
|
1230 |
18 Oct 10 |
peter |
26 |
#include "Directory.h" |
1290 |
12 Nov 10 |
peter |
27 |
#include "DirectoryPrinter.h" |
1230 |
18 Oct 10 |
peter |
28 |
#include "File.h" |
1290 |
12 Nov 10 |
peter |
29 |
#include "FilePrinter.h" |
1230 |
18 Oct 10 |
peter |
30 |
#include "NodeVisitor.h" |
1230 |
18 Oct 10 |
peter |
31 |
|
1478 |
29 May 12 |
peter |
32 |
#include <algorithm> |
1523 |
28 Sep 12 |
peter |
33 |
#include <cassert> |
1478 |
29 May 12 |
peter |
34 |
|
1230 |
18 Oct 10 |
peter |
35 |
namespace theplu { |
1230 |
18 Oct 10 |
peter |
36 |
namespace svndigest { |
1230 |
18 Oct 10 |
peter |
37 |
|
1230 |
18 Oct 10 |
peter |
38 |
SvndigestVisitor::SvndigestVisitor(bool verbose, bool ignore_cache, |
1535 |
06 Oct 12 |
peter |
39 |
bool report, bool update) |
1535 |
06 Oct 12 |
peter |
40 |
: verbose_(verbose), ignore_cache_(ignore_cache), report_(report), |
1535 |
06 Oct 12 |
peter |
41 |
update_(update) |
1230 |
18 Oct 10 |
peter |
42 |
{} |
1230 |
18 Oct 10 |
peter |
43 |
|
1230 |
18 Oct 10 |
peter |
44 |
|
1423 |
16 Dec 11 |
peter |
45 |
bool SvndigestVisitor::enter(Directory& dir) |
1230 |
18 Oct 10 |
peter |
46 |
{ |
1478 |
29 May 12 |
peter |
47 |
svn_revnum_t r = dir.property().svndigest_ignore_rev(); |
1478 |
29 May 12 |
peter |
48 |
if (ignore_rev_.size() && r<ignore_rev_.back()) |
1478 |
29 May 12 |
peter |
49 |
ignore_rev_.push_back(ignore_rev_.back()); |
1478 |
29 May 12 |
peter |
50 |
ignore_rev_.push_back(r); |
1449 |
22 Dec 11 |
peter |
51 |
if (dir.svndigest_ignore()) |
1230 |
18 Oct 10 |
peter |
52 |
return false; |
1230 |
18 Oct 10 |
peter |
53 |
return true; |
1230 |
18 Oct 10 |
peter |
54 |
} |
1230 |
18 Oct 10 |
peter |
55 |
|
1423 |
16 Dec 11 |
peter |
56 |
|
1423 |
16 Dec 11 |
peter |
57 |
void SvndigestVisitor::leave(Directory& dir) |
1230 |
18 Oct 10 |
peter |
58 |
{ |
1478 |
29 May 12 |
peter |
59 |
assert(ignore_rev_.size()); |
1478 |
29 May 12 |
peter |
60 |
ignore_rev_.pop_back(); |
1230 |
18 Oct 10 |
peter |
61 |
if (report_) { |
1232 |
23 Oct 10 |
peter |
62 |
dir.collect_stats(); |
1232 |
23 Oct 10 |
peter |
63 |
dir.init_tiny_stats(); |
1290 |
12 Nov 10 |
peter |
64 |
DirectoryPrinter dp(dir); |
1538 |
07 Oct 12 |
peter |
65 |
dp.print(verbose_, update_); |
1230 |
18 Oct 10 |
peter |
66 |
} |
1230 |
18 Oct 10 |
peter |
67 |
} |
1230 |
18 Oct 10 |
peter |
68 |
|
1423 |
16 Dec 11 |
peter |
69 |
|
1230 |
18 Oct 10 |
peter |
70 |
void SvndigestVisitor::visit(File& file) |
1230 |
18 Oct 10 |
peter |
71 |
{ |
1478 |
29 May 12 |
peter |
72 |
if (!file.svndigest_ignore()) { |
1478 |
29 May 12 |
peter |
73 |
svn_revnum_t rev = file.property().svndigest_ignore_rev(); |
1478 |
29 May 12 |
peter |
74 |
assert(ignore_rev_.size()); |
1478 |
29 May 12 |
peter |
75 |
rev = std::max(rev, ignore_rev_.back()); |
1478 |
29 May 12 |
peter |
76 |
file.parse(verbose_, ignore_cache_, rev); |
1478 |
29 May 12 |
peter |
77 |
} |
1232 |
23 Oct 10 |
peter |
78 |
if (report_) { |
1232 |
23 Oct 10 |
peter |
79 |
file.init_tiny_stats(); |
1449 |
22 Dec 11 |
peter |
80 |
if (!file.svndigest_ignore()) { |
1290 |
12 Nov 10 |
peter |
81 |
FilePrinter fp(file); |
1537 |
07 Oct 12 |
peter |
82 |
fp.print(verbose_, update_); |
1290 |
12 Nov 10 |
peter |
83 |
} |
1232 |
23 Oct 10 |
peter |
84 |
} |
1230 |
18 Oct 10 |
peter |
85 |
} |
1230 |
18 Oct 10 |
peter |
86 |
|
1230 |
18 Oct 10 |
peter |
87 |
}} // end of namespace svndigest and namespace theplu |