Commits

Yuya Nishihara committed d96f9d6

serve: move run function to bottom

Comments (0)

Files changed (1)

tortoisehg/hgqt/serve.py

                                 _create_server)
         _setupwrapper_done = True
 
-def run(ui, *pats, **opts):
-    repopath = opts.get('root') or paths.find_root()
-    webconfpath = opts.get('web_conf') or opts.get('webdir_conf')
-    dlg = ServeDialog(webconf=_newwebconf(repopath, webconfpath))
-
-    lui = ui.copy()
-    if webconfpath:
-        lui.readconfig(webconfpath)
-    elif repopath:
-        lui.readconfig(os.path.join(repopath, '.hg', 'hgrc'), repopath)
-    try:
-        dlg.setport(int(lui.config('web', 'port', '8000')))
-    except ValueError:
-        pass
-
-    if repopath or webconfpath:
-        dlg.start()
-    return dlg
-
 def _asconfigliststr(value):
     r"""
     >>> _asconfigliststr('foo')
         except (EnvironmentError, error.Abort, error.RepoError):
             c.set('paths', '/', repopath)
         return c
+
+def run(ui, *pats, **opts):
+    repopath = opts.get('root') or paths.find_root()
+    webconfpath = opts.get('web_conf') or opts.get('webdir_conf')
+    dlg = ServeDialog(webconf=_newwebconf(repopath, webconfpath))
+
+    lui = ui.copy()
+    if webconfpath:
+        lui.readconfig(webconfpath)
+    elif repopath:
+        lui.readconfig(os.path.join(repopath, '.hg', 'hgrc'), repopath)
+    try:
+        dlg.setport(int(lui.config('web', 'port', '8000')))
+    except ValueError:
+        pass
+
+    if repopath or webconfpath:
+        dlg.start()
+    return dlg