# HG changeset patch # User Aurelien Campeas # Date 1404921165 -7200 # Node ID af47954c1015cbb5f99bc04ef29546f7bda7ade9 # Parent 3914388b2d0f32767c6dd7f47df4077b47981c1c [migration] remove repo_connect and use config.repository() instead One less more redundant path to the repo. Related to #3933480. diff -r 3914388b2d0f -r af47954c1015 cwctl.py --- a/cwctl.py Wed Jul 09 16:32:14 2014 +0200 +++ b/cwctl.py Wed Jul 09 17:52:45 2014 +0200 @@ -767,7 +767,7 @@ set_sources_mode(self.config.ext_sources or ('migration',)) # get instance and installed versions for the server and the componants mih = config.migration_handler() - repo = mih.repo_connect() + repo = mih.repo vcconf = repo.get_versions() helper = self.config_helper(config, required=False) if self.config.force_cube_version: @@ -856,8 +856,7 @@ config.quick_start = True if hasattr(config, 'set_sources_mode'): config.set_sources_mode(('migration',)) - repo = config.migration_handler().repo_connect() - vcconf = repo.get_versions() + vcconf = config.repository().get_versions() for key in sorted(vcconf): print key+': %s.%s.%s' % vcconf[key] diff -r 3914388b2d0f -r af47954c1015 devtools/testlib.py --- a/devtools/testlib.py Wed Jul 09 16:32:14 2014 +0200 +++ b/devtools/testlib.py Wed Jul 09 17:52:45 2014 +0200 @@ -313,7 +313,6 @@ login = unicode(db_handler.config.default_admin_config['login']) self.admin_access = self.new_access(login) self._admin_session = self.admin_access._session - self.config.repository = lambda x=None: self.repo # config management ######################################################## diff -r 3914388b2d0f -r af47954c1015 migration.py --- a/migration.py Wed Jul 09 16:32:14 2014 +0200 +++ b/migration.py Wed Jul 09 17:52:45 2014 +0200 @@ -139,9 +139,6 @@ raise raise AttributeError(name) - def repo_connect(self): - return self.config.repository() - def migrate(self, vcconf, toupgrade, options): """upgrade the given set of cubes diff -r 3914388b2d0f -r af47954c1015 server/migractions.py --- a/server/migractions.py Wed Jul 09 16:32:14 2014 +0200 +++ b/server/migractions.py Wed Jul 09 17:52:45 2014 +0200 @@ -96,7 +96,7 @@ self.repo = repo self.session = cnx.session elif connect: - self.repo_connect() + self.repo = config.repository() self.set_cnx() else: self.session = None @@ -152,12 +152,6 @@ sys.exit(0) self.session = self.repo._get_session(self.cnx.sessionid) - - @cached - def repo_connect(self): - self.repo = repoapi.get_repository(config=self.config) - return self.repo - def cube_upgraded(self, cube, version): self.cmd_set_property('system.version.%s' % cube.lower(), unicode(version)) @@ -194,7 +188,7 @@ def backup_database(self, backupfile=None, askconfirm=True, format='native'): config = self.config - repo = self.repo_connect() + repo = self.repo # paths timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') instbkdir = osp.join(config.appdatahome, 'backup') @@ -271,7 +265,7 @@ if written_format in ('portable', 'native'): format = written_format self.config.init_cnxset_pool = False - repo = self.repo_connect() + repo = self.repo source = repo.system_source try: source.restore(osp.join(tmpdir, source.uri), self.confirm, drop, format) diff -r 3914388b2d0f -r af47954c1015 server/serverctl.py --- a/server/serverctl.py Wed Jul 09 16:32:14 2014 +0200 +++ b/server/serverctl.py Wed Jul 09 17:52:45 2014 +0200 @@ -696,7 +696,7 @@ config.quick_start = True mih = config.migration_handler(connect=False, verbosity=1) mih.restore_database(backupfile, drop, askconfirm=False, format=format) - repo = mih.repo_connect() + repo = mih.repo # version of the database dbversions = repo.get_versions() mih.shutdown()