1. Brendan Cully
  2. tortoisehg/thg

Commits

Yuya Nishihara  committed e5d1146

serve: honor web.port setting (fixes #612)

  • Participants
  • Parent commits b1164a9
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/serve.py

View file
  • Ignore whitespace
         """Port number of the web server"""
         return int(self._qui.port_edit.value())
 
+    def setport(self, port):
+        self._qui.port_edit.setValue(port)
+
     def keyPressEvent(self, event):
         if self.isstarted() and event.key() == Qt.Key_Escape:
             self.stop()
     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