changeset 7730:bb5650d4a914

config: clarify naming of repo_root_path
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 23 Jan 2019 12:38:05 +0100
parents 7c5d28775cdf
children bac0ddd79c74
files kallithea/bin/kallithea_cli_db.py kallithea/lib/db_manage.py kallithea/tests/fixture.py
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_db.py	Wed Jan 23 12:44:35 2019 +0100
+++ b/kallithea/bin/kallithea_cli_db.py	Wed Jan 23 12:38:05 2019 +0100
@@ -57,8 +57,8 @@
     dbmanage = DbManage(dbconf=dbconf, root=kallithea.CONFIG['here'],
                         tests=False, cli_args=cli_args)
     dbmanage.create_tables(override=True)
-    opts = dbmanage.config_prompt(None)
-    dbmanage.create_settings(opts)
+    repo_root_path = dbmanage.prompt_repo_root_path(None)
+    dbmanage.create_settings(repo_root_path)
     dbmanage.create_default_user()
     dbmanage.admin_prompt()
     dbmanage.create_permissions()
--- a/kallithea/lib/db_manage.py	Wed Jan 23 12:44:35 2019 +0100
+++ b/kallithea/lib/db_manage.py	Wed Jan 23 12:38:05 2019 +0100
@@ -290,7 +290,7 @@
         for repo in Repository.query():
             repo.update_changeset_cache()
 
-    def config_prompt(self, test_repo_path='', retries=3):
+    def prompt_repo_root_path(self, test_repo_path='', retries=3):
         _path = self.cli_args.get('repos_location')
         if retries == 3:
             log.info('Setting up repositories config')
@@ -334,7 +334,7 @@
             if _path is not None:
                 sys.exit('Invalid repo path: %s' % _path)
             retries -= 1
-            return self.config_prompt(test_repo_path, retries) # recursing!!!
+            return self.prompt_repo_root_path(test_repo_path, retries) # recursing!!!
 
         real_path = os.path.normpath(os.path.realpath(path))
 
@@ -343,17 +343,16 @@
 
         return real_path
 
-    def create_settings(self, path):
-
+    def create_settings(self, repo_root_path):
         ui_config = [
             ('web', 'allow_archive', 'gz zip bz2', True),
             ('web', 'baseurl', '/', True),
-            ('paths', '/', path, True),
+            ('paths', '/', repo_root_path, True),
             #('phases', 'publish', 'false', False)
             ('hooks', Ui.HOOK_UPDATE, 'hg update >&2', False),
             ('hooks', Ui.HOOK_REPO_SIZE, 'python:kallithea.lib.hooks.repo_size', True),
             ('extensions', 'largefiles', '', True),
-            ('largefiles', 'usercache', os.path.join(path, '.cache', 'largefiles'), True),
+            ('largefiles', 'usercache', os.path.join(repo_root_path, '.cache', 'largefiles'), True),
             ('extensions', 'hgsubversion', '', False),
             ('extensions', 'hggit', '', False),
         ]
--- a/kallithea/tests/fixture.py	Wed Jan 23 12:44:35 2019 +0100
+++ b/kallithea/tests/fixture.py	Wed Jan 23 12:38:05 2019 +0100
@@ -368,7 +368,7 @@
                         tests=True)
     dbmanage.create_tables(override=True)
     # for tests dynamically set new root paths based on generated content
-    dbmanage.create_settings(dbmanage.config_prompt(repos_test_path))
+    dbmanage.create_settings(dbmanage.prompt_repo_root_path(repos_test_path))
     dbmanage.create_default_user()
     dbmanage.admin_prompt()
     dbmanage.create_permissions()