Loading lib/tool_shed/util/hgweb_config.py +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class HgWebConfigManager: self.hgweb_config_dir = None self.in_memory_config = None self.lock = threading.Lock() self.hgweb_repo_prefix = None def add_entry(self, lhs, rhs): """Add an entry in the hgweb.config file for a new repository.""" Loading lib/tool_shed/util/repository_util.py +2 −2 Original line number Diff line number Diff line Loading @@ -505,8 +505,8 @@ def update_repository(trans: "ProvidesUserContext", id: str, **kwds) -> Tuple[Op repo_dir = repository.repo_path(app) # Change the entry in the hgweb.config file for the repository. old_lhs = f"repos/{repository.user.username}/{repository.name}" new_lhs = f"repos/{repository.user.username}/{kwds['name']}" old_lhs = f"{trans.app.config.hgweb_repo_prefix}{repository.user.username}/{repository.name}" new_lhs = f"{trans.app.config.hgweb_repo_prefix}{repository.user.username}/{kwds['name']}" trans.app.hgweb_config_manager.change_entry(old_lhs, new_lhs, repo_dir) # Change the entry in the repository's hgrc file. Loading lib/tool_shed/util/shed_index.py +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ def _get_or_create_index(whoosh_index_dir): return get_or_create_index(whoosh_index_dir, repo_schema), get_or_create_index(tool_index_dir, tool_schema) def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): def build_index(whoosh_index_dir, file_path, hgweb_config_dir, hgweb_repo_prefix, dburi, **kwargs): """ Build two search indexes simultaneously One is for repositories and the other for tools. Loading @@ -51,7 +51,7 @@ def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): execution_timer = ExecutionTimer() with repo_index.searcher() as searcher: for repo in get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): for repo in get_repos(sa_session, file_path, hgweb_config_dir, hgweb_repo_prefix, **kwargs): tools_list = repo.pop("tools_list") repo_id = repo["id"] indexed_document = searcher.document(id=repo_id) Loading Loading @@ -85,7 +85,7 @@ def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): return repos_indexed, tools_indexed def get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): def get_repos(sa_session, file_path, hgweb_config_dir, hgweb_repo_prefix, **kwargs): """ Load repos from DB and included tools from .xml configs. """ Loading Loading @@ -126,7 +126,7 @@ def get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): # Load all changesets of the repo for lineage. repo_path = os.path.join( hgweb_config_dir, hgwcm.get_entry(os.path.join("repos", repo.user.username, repo.name)) hgweb_config_dir, hgwcm.get_entry(os.path.join(hgweb_repo_prefix, repo.user.username, repo.name)) ) hg_repo = hg.repository(ui.ui(), repo_path.encode("utf-8")) lineage = [] Loading lib/tool_shed/webapp/api/tools.py +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class ToolsController(BaseAPIController): trans.app.config.whoosh_index_dir, trans.app.config.file_path, trans.app.config.hgweb_config_dir, trans.app.config.hgweb_repo_prefix, trans.app.config.database_connection, ) return { Loading lib/tool_shed/webapp/app.py +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ class UniverseApplication(ToolShedApp, SentryClientMixin, HaltableContainer): # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located. self.hgweb_config_manager = hgweb_config_manager self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir self.hgweb_config_manager.hgweb_repo_prefix = self.config.hgweb_repo_prefix # Initialize the repository registry. self.repository_registry = tool_shed.repository_registry.Registry(self) # Configure Sentry client if configured Loading Loading
lib/tool_shed/util/hgweb_config.py +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ class HgWebConfigManager: self.hgweb_config_dir = None self.in_memory_config = None self.lock = threading.Lock() self.hgweb_repo_prefix = None def add_entry(self, lhs, rhs): """Add an entry in the hgweb.config file for a new repository.""" Loading
lib/tool_shed/util/repository_util.py +2 −2 Original line number Diff line number Diff line Loading @@ -505,8 +505,8 @@ def update_repository(trans: "ProvidesUserContext", id: str, **kwds) -> Tuple[Op repo_dir = repository.repo_path(app) # Change the entry in the hgweb.config file for the repository. old_lhs = f"repos/{repository.user.username}/{repository.name}" new_lhs = f"repos/{repository.user.username}/{kwds['name']}" old_lhs = f"{trans.app.config.hgweb_repo_prefix}{repository.user.username}/{repository.name}" new_lhs = f"{trans.app.config.hgweb_repo_prefix}{repository.user.username}/{kwds['name']}" trans.app.hgweb_config_manager.change_entry(old_lhs, new_lhs, repo_dir) # Change the entry in the repository's hgrc file. Loading
lib/tool_shed/util/shed_index.py +4 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ def _get_or_create_index(whoosh_index_dir): return get_or_create_index(whoosh_index_dir, repo_schema), get_or_create_index(tool_index_dir, tool_schema) def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): def build_index(whoosh_index_dir, file_path, hgweb_config_dir, hgweb_repo_prefix, dburi, **kwargs): """ Build two search indexes simultaneously One is for repositories and the other for tools. Loading @@ -51,7 +51,7 @@ def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): execution_timer = ExecutionTimer() with repo_index.searcher() as searcher: for repo in get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): for repo in get_repos(sa_session, file_path, hgweb_config_dir, hgweb_repo_prefix, **kwargs): tools_list = repo.pop("tools_list") repo_id = repo["id"] indexed_document = searcher.document(id=repo_id) Loading Loading @@ -85,7 +85,7 @@ def build_index(whoosh_index_dir, file_path, hgweb_config_dir, dburi, **kwargs): return repos_indexed, tools_indexed def get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): def get_repos(sa_session, file_path, hgweb_config_dir, hgweb_repo_prefix, **kwargs): """ Load repos from DB and included tools from .xml configs. """ Loading Loading @@ -126,7 +126,7 @@ def get_repos(sa_session, file_path, hgweb_config_dir, **kwargs): # Load all changesets of the repo for lineage. repo_path = os.path.join( hgweb_config_dir, hgwcm.get_entry(os.path.join("repos", repo.user.username, repo.name)) hgweb_config_dir, hgwcm.get_entry(os.path.join(hgweb_repo_prefix, repo.user.username, repo.name)) ) hg_repo = hg.repository(ui.ui(), repo_path.encode("utf-8")) lineage = [] Loading
lib/tool_shed/webapp/api/tools.py +1 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ class ToolsController(BaseAPIController): trans.app.config.whoosh_index_dir, trans.app.config.file_path, trans.app.config.hgweb_config_dir, trans.app.config.hgweb_repo_prefix, trans.app.config.database_connection, ) return { Loading
lib/tool_shed/webapp/app.py +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ class UniverseApplication(ToolShedApp, SentryClientMixin, HaltableContainer): # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located. self.hgweb_config_manager = hgweb_config_manager self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir self.hgweb_config_manager.hgweb_repo_prefix = self.config.hgweb_repo_prefix # Initialize the repository registry. self.repository_registry = tool_shed.repository_registry.Registry(self) # Configure Sentry client if configured Loading