aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 22:28:36 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 22:28:36 +0100
commit89957e6130d475fcc1eeb250021a0752c779b7be (patch)
treef523f7f4be0e106a5c1c7548ee9dc8908677ea48
parent151cfa6b0a01bc49a6cf6497a6c5e63fe580a3fc (diff)
downloadpaludis-89957e6130d475fcc1eeb250021a0752c779b7be.tar.gz
paludis-89957e6130d475fcc1eeb250021a0752c779b7be.tar.xz
Group together duplicate --explain items
Fixes: ticket:1200
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 9046b0f..5fc7368 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -404,15 +404,25 @@ namespace
void display_explanation_constraints(const Constraints & constraints)
{
- cout << fuc(fs_explanation_constraints_header());
+ std::map<std::string, std::set<std::string> > reasons_for_constraints;
for (Constraints::ConstIterator c(constraints.begin()), c_end(constraints.end()) ;
c != c_end ; ++c)
{
- cout << fuc(fs_explanation_constraint(), fv<'c'>(constraint_as_string(**c)));
+ auto & reasons(reasons_for_constraints.insert(std::make_pair(
+ constraint_as_string(**c), std::set<std::string>())).first->second);
ReasonNameGetter g(true, true);
- cout << fuc(fs_explanation_constraint_reason(), fv<'r'>(
- (*c)->reason()->accept_returning<std::pair<std::string, Tribool> >(g).first));
+ reasons.insert((*c)->reason()->accept_returning<std::pair<std::string, Tribool> >(g).first);
+ }
+
+ cout << fuc(fs_explanation_constraints_header());
+ for (auto c(reasons_for_constraints.begin()), c_end(reasons_for_constraints.end()) ;
+ c != c_end ; ++c)
+ {
+ cout << fuc(fs_explanation_constraint(), fv<'c'>(c->first));
+ for (auto r(c->second.begin()), r_end(c->second.end()) ;
+ r != r_end ; ++r)
+ cout << fuc(fs_explanation_constraint_reason(), fv<'r'>(*r));
}
}