# HG changeset patch # User Marcin Kuzminski # Date 2019-12-06 13:54:24 # Node ID 4f496d5f2d7c42739155879cf6c1e74caaead485 # Parent ecde08b98274dc5deb9ad22a8da6d34ecba6deeb mercurial: move imports from top-level to prevent from loading mercurial code on hook execution for svn/git diff --git a/vcsserver/hooks.py b/vcsserver/hooks.py --- a/vcsserver/hooks.py +++ b/vcsserver/hooks.py @@ -33,7 +33,6 @@ import mercurial.node import simplejson as json from vcsserver import exceptions, subprocessio, settings -from vcsserver.hgcompat import get_ctx log = logging.getLogger(__name__) @@ -184,6 +183,7 @@ def _extras_from_ui(ui): def _rev_range_hash(repo, node, check_heads=False): + from vcsserver.hgcompat import get_ctx commits = [] revs = [] @@ -203,6 +203,7 @@ def _rev_range_hash(repo, node, check_he def _check_heads(repo, start, end, commits): + from vcsserver.hgcompat import get_ctx changelog = repo.changelog parents = set() @@ -393,6 +394,7 @@ def post_push_ssh(ui, repo, node, **kwar def key_push(ui, repo, **kwargs): + from vcsserver.hgcompat import get_ctx if kwargs['new'] != '0' and kwargs['namespace'] == 'bookmarks': # store new bookmarks in our UI object propagated later to post_push ui._rc_pushkey_branches = get_ctx(repo, kwargs['key']).bookmarks()