-{
- pkgCache &Cache = *GCache;
- pkgDepCache::Policy Plcy;
-
- APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(Cache, CmdL.FileList);
- for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
- {
- // Find the proper version to use.
- if (_config->FindB("APT::Cache::AllVersions","true") == true)
- {
- pkgCache::VerIterator V;
- for (V = Pkg.VersionList(); V.end() == false; V++)
- {
- if (DisplayRecord(V) == false)
- return false;
- }
- }
- else
- {
- pkgCache::VerIterator V = Plcy.GetCandidateVer(Pkg);
- if (V.end() == true || V.FileList().end() == true)
- continue;
- if (DisplayRecord(V) == false)
- return false;
- }
- }
-
- if (pkgset.empty() == false)
+{
+ pkgCacheFile CacheFile;
+ APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
+ APT::VersionSet::ALL : APT::VersionSet::INSTALLED;
+ APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList, select);
+ for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
+ if (DisplayRecord(CacheFile, Ver) == false)
+ return false;
+
+ if (verset.empty() == false)