diff kallithea/lib/vcs/backends/hg/inmemory.py @ 8728:f3fab7b124f2

imports: try to use global imports unless it is a layering violation To minimize the impact, do imports that violate the layering at runtime instead of at import time.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 01 Nov 2020 06:29:32 +0100
parents f9988201a3c4
children
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/inmemory.py	Fri Oct 30 14:54:42 2020 +0100
+++ b/kallithea/lib/vcs/backends/hg/inmemory.py	Sun Nov 01 06:29:32 2020 +0100
@@ -7,6 +7,8 @@
 from kallithea.lib.vcs.exceptions import RepositoryError
 from kallithea.lib.vcs.utils import ascii_str, safe_bytes, safe_str
 
+from . import repository
+
 
 class MercurialInMemoryChangeset(BaseInMemoryChangeset):
 
@@ -35,9 +37,8 @@
         if not isinstance(author, str):
             raise RepositoryError('author must be a str - got %r' % type(author))
 
-        from .repository import MercurialRepository
         if branch is None:
-            branch = MercurialRepository.DEFAULT_BRANCH_NAME
+            branch = repository.MercurialRepository.DEFAULT_BRANCH_NAME
         kwargs[b'branch'] = safe_bytes(branch)
 
         def filectxfn(_repo, memctx, bytes_path):