1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 def List(remote_manifest, local_manifest, display_revisions):
6 any_bundles_need_update = False
8 print ' I: installed\n *: update available\n'
9 for bundle in remote_manifest.GetBundles():
10 local_bundle = local_manifest.GetBundle(bundle.name)
11 needs_update = local_bundle and local_manifest.BundleNeedsUpdate(bundle)
13 any_bundles_need_update = True
15 _PrintBundle(local_bundle, bundle, needs_update, display_revisions)
17 if not any_bundles_need_update:
18 print '\nAll installed bundles are up-to-date.'
20 local_only_bundles = set([b.name for b in local_manifest.GetBundles()])
21 local_only_bundles -= set([b.name for b in remote_manifest.GetBundles()])
22 if local_only_bundles:
23 print '\nBundles installed locally that are not available remotely:'
24 for bundle_name in local_only_bundles:
25 local_bundle = local_manifest.GetBundle(bundle_name)
26 _PrintBundle(local_bundle, None, False, display_revisions)
29 def _PrintBundle(local_bundle, bundle, needs_update, display_revisions):
30 installed = local_bundle is not None
31 # If bundle is None, there is no longer a remote bundle with this name.
37 revision = ' (r%s -> r%s)' % (local_bundle.revision, bundle.revision)
39 revision = ' (r%s)' % (bundle.revision,)
43 print (' %s%s %s (%s)%s' % (
44 'I' if installed else ' ',
45 '*' if needs_update else ' ',