From 3a4aa44f5c49856fb0c09739a86d7af860165bdf Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Mon, 30 Jul 2007 16:02:24 +0000 Subject: [PATCH] - cleaned up RepoInfo tribools --- src/zypper-misc.cc | 1 + src/zypper-sources.cc | 13 +++++-------- src/zypper.cc | 6 ++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index 9197ab4..a3597d0 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include #include diff --git a/src/zypper-sources.cc b/src/zypper-sources.cc index 971fbef..87b15f9 100644 --- a/src/zypper-sources.cc +++ b/src/zypper-sources.cc @@ -116,8 +116,7 @@ static void print_repo_list( const std::list &repos ) // zypper status (enabled, autorefresh) else { - tr << (repo.enabled() || indeterminate(repo.enabled()) ? - _("Yes") : _("No")); + tr << (repo.enabled() ? _("Yes") : _("No")); tr << (repo.autorefresh() ? _("Yes") : _("No")); } @@ -366,17 +365,15 @@ int add_repo_from_file(const std::string & repo_file_url, { RepoInfo repo = *it; + // by default set enabled and autorefresh to true + repo.setEnabled(true); + repo.setAutorefresh(true); + if (!indeterminate(enabled)) repo.setEnabled(enabled); if (!indeterminate(autorefresh)) repo.setAutorefresh(autorefresh); - // by default set enabled and autorefresh to true - if (indeterminate(repo.enabled())) - repo.setEnabled(true); - if (indeterminate(repo.autorefresh())) - repo.setAutorefresh(true); - add_repo(repo); } diff --git a/src/zypper.cc b/src/zypper.cc index 5fbdae5..c8a8cab 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -696,7 +696,8 @@ int one_command(const ZypperCommand & command, int argc, char **argv) return ZYPPER_EXIT_ERR_PRIVILEGES; } - tribool enabled(indeterminate); + // indeterminate indicates the user has not specified the values + tribool enabled(indeterminate); tribool refresh(indeterminate); if (copts.count("disabled")) @@ -729,10 +730,11 @@ int one_command(const ZypperCommand & command, int argc, char **argv) string alias; if (arguments.size() > 1) alias = arguments[1]; - //! \todo use timestamp as alias, if no alias was given + //! \todo use timestamp as alias, if no alias was given? if (alias.empty ()) alias = url.asString(); + // by default, enable the repo and set autorefresh if (indeterminate(enabled)) enabled = true; if (indeterminate(refresh)) refresh = true; -- 2.7.4