summaryrefslogtreecommitdiffstats
path: root/sinksh/syntax_modules
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-08-14 08:30:06 -0600
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-08-14 08:30:06 -0600
commitb63ae293c4f93d3bea9f1a7d96baf006cc459597 (patch)
tree9d22a0a34b6e44c53ebd4c9199a367e769fb71f5 /sinksh/syntax_modules
parent1c455b9a0b6d5a7abb0e8e9ab68e338c62811d24 (diff)
downloadsink-b63ae293c4f93d3bea9f1a7d96baf006cc459597.tar.gz
sink-b63ae293c4f93d3bea9f1a7d96baf006cc459597.zip
Only count every uid once.
The previous code would fail on the second revision with the same uid.
Diffstat (limited to 'sinksh/syntax_modules')
-rw-r--r--sinksh/syntax_modules/sink_inspect.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/sinksh/syntax_modules/sink_inspect.cpp b/sinksh/syntax_modules/sink_inspect.cpp
index b271b4f..9cc3b23 100644
--- a/sinksh/syntax_modules/sink_inspect.cpp
+++ b/sinksh/syntax_modules/sink_inspect.cpp
@@ -85,10 +85,9 @@ bool inspect(const QStringList &args, State &state)
85 }, 85 },
86 false); 86 false);
87 87
88 QSet<QByteArray> uids;
88 db.scan("", [&] (const QByteArray &key, const QByteArray &data) { 89 db.scan("", [&] (const QByteArray &key, const QByteArray &data) {
89 if (!hash.remove(Sink::Storage::DataStore::uidFromKey(key))) { 90 uids.insert(Sink::Storage::DataStore::uidFromKey(key));
90 qWarning() << "Failed to find RID for " << key;
91 }
92 return true; 91 return true;
93 }, 92 },
94 [&](const Sink::Storage::DataStore::Error &e) { 93 [&](const Sink::Storage::DataStore::Error &e) {
@@ -96,6 +95,17 @@ bool inspect(const QStringList &args, State &state)
96 }, 95 },
97 false); 96 false);
98 97
98 int missing = 0;
99 for (const auto &uid : uids) {
100 if (!hash.remove(uid)) {
101 missing++;
102 qWarning() << "Failed to find RID for " << uid;
103 }
104 }
105 if (missing) {
106 qWarning() << "Found a total of " << missing << " missing rids";
107 }
108
99 //If we still have items in the hash it means we have rid mappings for entities 109 //If we still have items in the hash it means we have rid mappings for entities
100 //that no longer exist. 110 //that no longer exist.
101 if (!hash.isEmpty()) { 111 if (!hash.isEmpty()) {