changeset 27352:9fd8f1552369

commandserver: cut import cycle by itself We generally make modules importable from the front-end layer, dispatch -> commands -> x. So the import cycle to dispatch should be resolved by the commandserver module.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 24 Nov 2015 23:03:54 +0900
parents 28e50c4b15ed
children 98e59d9e0d77
files mercurial/commands.py mercurial/commandserver.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Nov 24 22:58:40 2015 +0900
+++ b/mercurial/commands.py	Tue Nov 24 23:03:54 2015 +0900
@@ -23,6 +23,7 @@
 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
 import ui as uimod
 import streamclone
+import commandserver
 
 table = {}
 
@@ -6184,7 +6185,6 @@
         s.serve_forever()
 
     if opts["cmdserver"]:
-        import commandserver
         service = commandserver.createservice(ui, repo, opts)
     else:
         service = hgweb.createservice(ui, repo, opts)
--- a/mercurial/commandserver.py	Tue Nov 24 22:58:40 2015 +0900
+++ b/mercurial/commandserver.py	Tue Nov 24 23:03:54 2015 +0900
@@ -16,7 +16,6 @@
 
 from .i18n import _
 from . import (
-    dispatch,
     encoding,
     error,
     util,
@@ -186,6 +185,7 @@
     def runcommand(self):
         """ reads a list of \0 terminated arguments, executes
         and writes the return code to the result channel """
+        from . import dispatch  # avoid cycle
 
         length = struct.unpack('>I', self._read(4))[0]
         if not length: