--- a/cwctl.py Thu Jun 30 16:26:37 2011 +0200
+++ b/cwctl.py Wed Jun 29 16:29:15 2011 +0200
@@ -799,6 +799,28 @@
return False
return True
+
+class ListVersionsInstanceCommand(InstanceCommand):
+ """List versions used by an instance.
+
+ <instance>...
+ identifiers of the instances to list versions for.
+ """
+ name = 'versions'
+
+ def versions_instance(self, appid):
+ from logilab.common.changelog import Version
+ config = cwcfg.config_for(appid)
+ # should not raise error if db versions don't match fs versions
+ config.repairing = True
+ if hasattr(config, 'set_sources_mode'):
+ config.set_sources_mode(('migration',))
+ repo = config.migration_handler().repo_connect()
+ vcconf = repo.get_versions()
+ for key in sorted(vcconf):
+ print key+': %s.%s.%s' % vcconf[key]
+
+
class ShellCommand(Command):
"""Run an interactive migration shell on an instance. This is a python shell
with enhanced migration commands predefined in the namespace. An additional
@@ -961,6 +983,7 @@
StartInstanceCommand, StopInstanceCommand, RestartInstanceCommand,
ReloadConfigurationCommand, StatusCommand,
UpgradeInstanceCommand,
+ ListVersionsInstanceCommand,
ShellCommand,
RecompileInstanceCatalogsCommand,
ListInstancesCommand, ListCubesCommand,