From 4d40de77f357e5be20eeb90543a97a5620241420 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Kupec?= Date: Thu, 16 Jul 2009 01:46:12 +0200 Subject: [PATCH] list-updates: show also current version (bnc #466599) --- src/update.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/update.cc b/src/update.cc index 91925d8..606f9a8 100755 --- a/src/update.cc +++ b/src/update.cc @@ -531,7 +531,11 @@ void list_updates(Zypper & zypper, const ResKindSet & kinds, bool best_effort) th << _("Name"); // best_effort does not know version or arch yet if (!best_effort) - th << _("Version") << _("Arch"); + { + if (*it == ResKind::package) + th << _("Current Version"); + th << _("Available Version") << _("Arch"); + } tbl << th; @@ -542,8 +546,6 @@ void list_updates(Zypper & zypper, const ResKindSet & kinds, bool best_effort) Candidates::iterator cb = candidates.begin (), ce = candidates.end (), ci; for (ci = cb; ci != ce; ++ci) { -// ResStatus& candstat = ci->status(); -// candstat.setToBeInstalled (ResStatus::USER); ResObject::constPtr res = ci->resolvable(); TableRow tr (cols); tr << "v"; @@ -556,9 +558,15 @@ void list_updates(Zypper & zypper, const ResKindSet & kinds, bool best_effort) // strictly speaking, we could show version and arch even in best_effort // iff there is only one candidate. But we don't know the number of candidates here. - if (!best_effort) { - tr << res->edition ().asString () - << res->arch ().asString (); + if (!best_effort) + { + // for packages show also the current installed version (bnc #466599) + //! \todo this deserves cleanup and optimization: e.g. findInstalledItem() + //! is called twice, once here and once in find_updates() + if (*it == ResKind::package) + tr << findInstalledItem(PoolItem(ci->resolvable()))->edition().asString(); + tr << res->edition ().asString () + << res->arch ().asString (); } tbl << tr; } -- 2.7.4