From: Jan Kupec Date: Mon, 30 Jul 2007 16:02:24 +0000 (+0000) Subject: - cleaned up RepoInfo tribools X-Git-Tag: BASE-SuSE-Linux-10_3-Branch~234 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a4aa44f5c49856fb0c09739a86d7af860165bdf;p=platform%2Fupstream%2Fzypper.git - cleaned up RepoInfo tribools --- 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;