Added action to start a Mercurial server to the Mercurial plug-in.

Sat, 29 May 2010 17:52:59 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 29 May 2010 17:52:59 +0200
changeset 305
5cf9e308f342
parent 304
98429932e0c9
child 306
08334d7d458e

Added action to start a Mercurial server to the Mercurial plug-in.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.hg.html file | annotate | diff | comparison | revisions
Documentation/Source/index-eric5.Plugins.VcsPlugins.vcsMercurial.html file | annotate | diff | comparison | revisions
Plugins/PluginVcsMercurial.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgServeDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/icons/startServer.png file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/icons/stopServer.png file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
eric5.e4p file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sat May 29 15:26:00 2010 +0200
+++ b/APIs/Python3/eric5.api	Sat May 29 17:52:59 2010 +0200
@@ -2913,6 +2913,8 @@
 eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionSelectionDialog.HgRevisionSelectionDialog?1(tagsList, branchesList, showNone = False, parent = None)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog.HgRevisionsSelectionDialog.getRevisions?4()
 eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog.HgRevisionsSelectionDialog?1(tagsList, branchesList, parent = None)
+eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.HgServeDialog.closeEvent?4(e)
+eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.HgServeDialog?1(vcs, path, parent = None)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.HgStatusDialog.closeEvent?4(e)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.HgStatusDialog.keyPressEvent?4(evt)
 eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.HgStatusDialog.on_buttonBox_clicked?4(button)
@@ -2981,6 +2983,7 @@
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgPush?4(name, force = False)
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgRecover?4(name)
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgResolve?4(name)
+eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgServe?4(name)
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgShowBranch?4(name)
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgShowConfig?4(name)
 eric5.Plugins.VcsPlugins.vcsMercurial.hg.Hg.hgShowPaths?4(name)
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sat May 29 15:26:00 2010 +0200
+++ b/Documentation/Help/source.qhp	Sat May 29 17:52:59 2010 +0200
@@ -342,6 +342,7 @@
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgOptionsDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgOptionsDialog.html" />
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionSelectionDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionSelectionDialog.html" />
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog.html" />
+                <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html" />
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html" />
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusMonitorThread" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusMonitorThread.html" />
                 <section title="eric5.Plugins.VcsPlugins.vcsMercurial.HgTagBranchListDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgTagBranchListDialog.html" />
@@ -7854,6 +7855,7 @@
       <keyword name="Hg.hgPush" id="Hg.hgPush" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgPush" />
       <keyword name="Hg.hgRecover" id="Hg.hgRecover" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgRecover" />
       <keyword name="Hg.hgResolve" id="Hg.hgResolve" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgResolve" />
+      <keyword name="Hg.hgServe" id="Hg.hgServe" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgServe" />
       <keyword name="Hg.hgShowBranch" id="Hg.hgShowBranch" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgShowBranch" />
       <keyword name="Hg.hgShowConfig" id="Hg.hgShowConfig" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgShowConfig" />
       <keyword name="Hg.hgShowPaths" id="Hg.hgShowPaths" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.hgShowPaths" />
@@ -7890,6 +7892,17 @@
       <keyword name="Hg.vcsSwitch" id="Hg.vcsSwitch" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.vcsSwitch" />
       <keyword name="Hg.vcsTag" id="Hg.vcsTag" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.vcsTag" />
       <keyword name="Hg.vcsUpdate" id="Hg.vcsUpdate" ref="eric5.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.vcsUpdate" />
+      <keyword name="HgServeDialog (Module)" id="HgServeDialog (Module)" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html" />
+      <keyword name="HgServeDialog" id="HgServeDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog" />
+      <keyword name="HgServeDialog (Constructor)" id="HgServeDialog (Constructor)" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__init__" />
+      <keyword name="HgServeDialog.__appendText" id="HgServeDialog.__appendText" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__appendText" />
+      <keyword name="HgServeDialog.__procFinished" id="HgServeDialog.__procFinished" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__procFinished" />
+      <keyword name="HgServeDialog.__readStderr" id="HgServeDialog.__readStderr" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__readStderr" />
+      <keyword name="HgServeDialog.__readStdout" id="HgServeDialog.__readStdout" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__readStdout" />
+      <keyword name="HgServeDialog.__startBrowser" id="HgServeDialog.__startBrowser" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__startBrowser" />
+      <keyword name="HgServeDialog.__startServer" id="HgServeDialog.__startServer" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__startServer" />
+      <keyword name="HgServeDialog.__stopServer" id="HgServeDialog.__stopServer" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.__stopServer" />
+      <keyword name="HgServeDialog.closeEvent" id="HgServeDialog.closeEvent" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html#HgServeDialog.closeEvent" />
       <keyword name="HgTagDialog (Module)" id="HgTagDialog (Module)" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgTagDialog.html" />
       <keyword name="HgTagDialog" id="HgTagDialog" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgTagDialog.html#HgTagDialog" />
       <keyword name="HgTagDialog (Constructor)" id="HgTagDialog (Constructor)" ref="eric5.Plugins.VcsPlugins.vcsMercurial.HgTagDialog.html#HgTagDialog.__init__" />
@@ -7941,6 +7954,7 @@
       <keyword name="HgProjectHelper.__hgPushForced" id="HgProjectHelper.__hgPushForced" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgPushForced" />
       <keyword name="HgProjectHelper.__hgRecover" id="HgProjectHelper.__hgRecover" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgRecover" />
       <keyword name="HgProjectHelper.__hgResolve" id="HgProjectHelper.__hgResolve" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgResolve" />
+      <keyword name="HgProjectHelper.__hgServe" id="HgProjectHelper.__hgServe" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgServe" />
       <keyword name="HgProjectHelper.__hgShowBranch" id="HgProjectHelper.__hgShowBranch" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgShowBranch" />
       <keyword name="HgProjectHelper.__hgShowConfig" id="HgProjectHelper.__hgShowConfig" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgShowConfig" />
       <keyword name="HgProjectHelper.__hgShowPaths" id="HgProjectHelper.__hgShowPaths" ref="eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html#HgProjectHelper.__hgShowPaths" />
@@ -9877,6 +9891,7 @@
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgOptionsDialog.html</file>
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionSelectionDialog.html</file>
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog.html</file>
+      <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html</file>
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html</file>
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusMonitorThread.html</file>
       <file>eric5.Plugins.VcsPlugins.vcsMercurial.HgTagBranchListDialog.html</file>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html	Sat May 29 17:52:59 2010 +0200
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
+'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html><head>
+<title>eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog</title>
+<style>
+body {
+    background:white;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #4FA4FF; }
+h2 { color: white; background: #4FA4FF; }
+h3 { color: white; background: #00557F; }
+h4 { color: white; background: #00557F; }
+    
+a { color: #AA5500; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog</h1>
+<p>
+Module implementing a dialog for the Mercurial server.
+</p>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr>
+<td><a href="#HgServeDialog">HgServeDialog</a></td>
+<td>Class implementing a dialog for the Mercurial server.</td>
+</tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<hr /><hr />
+<a NAME="HgServeDialog" ID="HgServeDialog"></a>
+<h2>HgServeDialog</h2>
+<p>
+    Class implementing a dialog for the Mercurial server.
+</p>
+<h3>Derived from</h3>
+QMainWindow
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#HgServeDialog.__init__">HgServeDialog</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__appendText">__appendText</a></td>
+<td>Public method to append text to the end.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__procFinished">__procFinished</a></td>
+<td>Private slot connected to the finished signal.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__readStderr">__readStderr</a></td>
+<td>Private slot to handle the readyReadStandardError signal.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__readStdout">__readStdout</a></td>
+<td>Private slot to handle the readyReadStandardOutput signal.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__startBrowser">__startBrowser</a></td>
+<td>Private slot to start a browser for the served repository.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__startServer">__startServer</a></td>
+<td>Private slot to start the Mercurial server.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.__stopServer">__stopServer</a></td>
+<td>Private slot to stop the Mercurial server.</td>
+</tr><tr>
+<td><a href="#HgServeDialog.closeEvent">closeEvent</a></td>
+<td>Private slot implementing a close event handler.</td>
+</tr>
+</table>
+<a NAME="HgServeDialog.__init__" ID="HgServeDialog.__init__"></a>
+<h4>HgServeDialog (Constructor)</h4>
+<b>HgServeDialog</b>(<i>vcs, path, parent = None</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>vcs</i></dt>
+<dd>
+reference to the vcs object
+</dd><dt><i>path</i></dt>
+<dd>
+path of the repository to serve (string)
+</dd><dt><i>parent</i></dt>
+<dd>
+reference to the parent widget (QWidget)
+</dd>
+</dl><a NAME="HgServeDialog.__appendText" ID="HgServeDialog.__appendText"></a>
+<h4>HgServeDialog.__appendText</h4>
+<b>__appendText</b>(<i>txt, error = False</i>)
+<p>
+        Public method to append text to the end.
+</p><dl>
+<dt><i>txt</i></dt>
+<dd>
+text to insert (string)
+</dd><dt><i>error</i></dt>
+<dd>
+flag indicating to insert error text (boolean)
+</dd>
+</dl><a NAME="HgServeDialog.__procFinished" ID="HgServeDialog.__procFinished"></a>
+<h4>HgServeDialog.__procFinished</h4>
+<b>__procFinished</b>(<i>exitCode, exitStatus</i>)
+<p>
+        Private slot connected to the finished signal.
+</p><dl>
+<dt><i>exitCode</i></dt>
+<dd>
+exit code of the process (integer)
+</dd><dt><i>exitStatus</i></dt>
+<dd>
+exit status of the process (QProcess.ExitStatus)
+</dd>
+</dl><a NAME="HgServeDialog.__readStderr" ID="HgServeDialog.__readStderr"></a>
+<h4>HgServeDialog.__readStderr</h4>
+<b>__readStderr</b>(<i></i>)
+<p>
+        Private slot to handle the readyReadStandardError signal.
+</p><p>
+        It reads the error output of the process and inserts it into the log.
+</p><a NAME="HgServeDialog.__readStdout" ID="HgServeDialog.__readStdout"></a>
+<h4>HgServeDialog.__readStdout</h4>
+<b>__readStdout</b>(<i></i>)
+<p>
+        Private slot to handle the readyReadStandardOutput signal. 
+</p><p>
+        It reads the output of the process and inserts it into the log.
+</p><a NAME="HgServeDialog.__startBrowser" ID="HgServeDialog.__startBrowser"></a>
+<h4>HgServeDialog.__startBrowser</h4>
+<b>__startBrowser</b>(<i></i>)
+<p>
+        Private slot to start a browser for the served repository.
+</p><a NAME="HgServeDialog.__startServer" ID="HgServeDialog.__startServer"></a>
+<h4>HgServeDialog.__startServer</h4>
+<b>__startServer</b>(<i></i>)
+<p>
+        Private slot to start the Mercurial server.
+</p><a NAME="HgServeDialog.__stopServer" ID="HgServeDialog.__stopServer"></a>
+<h4>HgServeDialog.__stopServer</h4>
+<b>__stopServer</b>(<i></i>)
+<p>
+        Private slot to stop the Mercurial server.
+</p><a NAME="HgServeDialog.closeEvent" ID="HgServeDialog.closeEvent"></a>
+<h4>HgServeDialog.closeEvent</h4>
+<b>closeEvent</b>(<i>e</i>)
+<p>
+        Private slot implementing a close event handler.
+</p><dl>
+<dt><i>e</i></dt>
+<dd>
+close event (QCloseEvent)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file
--- a/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html	Sat May 29 15:26:00 2010 +0200
+++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.ProjectHelper.html	Sat May 29 17:52:59 2010 +0200
@@ -138,6 +138,9 @@
 <td><a href="#HgProjectHelper.__hgResolve">__hgResolve</a></td>
 <td>Private slot used to resolve conflicts of the local project.</td>
 </tr><tr>
+<td><a href="#HgProjectHelper.__hgServe">__hgServe</a></td>
+<td>Protected slot used to serve the project.</td>
+</tr><tr>
 <td><a href="#HgProjectHelper.__hgShowBranch">__hgShowBranch</a></td>
 <td>Private slot used to show the current branch for the project.</td>
 </tr><tr>
@@ -324,6 +327,11 @@
 <b>__hgResolve</b>(<i></i>)
 <p>
         Private slot used to resolve conflicts of the local project.
+</p><a NAME="HgProjectHelper.__hgServe" ID="HgProjectHelper.__hgServe"></a>
+<h4>HgProjectHelper.__hgServe</h4>
+<b>__hgServe</b>(<i></i>)
+<p>
+        Protected slot used to serve the project.
 </p><a NAME="HgProjectHelper.__hgShowBranch" ID="HgProjectHelper.__hgShowBranch"></a>
 <h4>HgProjectHelper.__hgShowBranch</h4>
 <b>__hgShowBranch</b>(<i></i>)
--- a/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.hg.html	Sat May 29 15:26:00 2010 +0200
+++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.hg.html	Sat May 29 17:52:59 2010 +0200
@@ -150,6 +150,9 @@
 <td><a href="#Hg.hgResolve">hgResolve</a></td>
 <td>Public method used to resolve conflicts of a file/directory.</td>
 </tr><tr>
+<td><a href="#Hg.hgServe">hgServe</a></td>
+<td>Public method used to edit the repository config file.</td>
+</tr><tr>
 <td><a href="#Hg.hgShowBranch">hgShowBranch</a></td>
 <td>Public method used to show the current branch the working directory.</td>
 </tr><tr>
@@ -617,6 +620,16 @@
 <dd>
 file/directory name to be resolved (string)
 </dd>
+</dl><a NAME="Hg.hgServe" ID="Hg.hgServe"></a>
+<h4>Hg.hgServe</h4>
+<b>hgServe</b>(<i>name</i>)
+<p>
+        Public method used to edit the repository config file.
+</p><dl>
+<dt><i>name</i></dt>
+<dd>
+directory name (string)
+</dd>
 </dl><a NAME="Hg.hgShowBranch" ID="Hg.hgShowBranch"></a>
 <h4>Hg.hgShowBranch</h4>
 <b>hgShowBranch</b>(<i>name</i>)
--- a/Documentation/Source/index-eric5.Plugins.VcsPlugins.vcsMercurial.html	Sat May 29 15:26:00 2010 +0200
+++ b/Documentation/Source/index-eric5.Plugins.VcsPlugins.vcsMercurial.html	Sat May 29 17:52:59 2010 +0200
@@ -87,6 +87,9 @@
 <td><a href="eric5.Plugins.VcsPlugins.vcsMercurial.HgRevisionsSelectionDialog.html">HgRevisionsSelectionDialog</a></td>
 <td>Module implementing a dialog to enter the revisions for the hg diff command.</td>
 </tr><tr>
+<td><a href="eric5.Plugins.VcsPlugins.vcsMercurial.HgServeDialog.html">HgServeDialog</a></td>
+<td>Module implementing a dialog for the Mercurial server.</td>
+</tr><tr>
 <td><a href="eric5.Plugins.VcsPlugins.vcsMercurial.HgStatusDialog.html">HgStatusDialog</a></td>
 <td>Module implementing a dialog to show the output of the hg status command process.</td>
 </tr><tr>
--- a/Plugins/PluginVcsMercurial.py	Sat May 29 15:26:00 2010 +0200
+++ b/Plugins/PluginVcsMercurial.py	Sat May 29 17:52:59 2010 +0200
@@ -146,7 +146,9 @@
             "UseLogBrowser"  : True, 
             "LogLimit"       : 100, 
             "CommitMessages" : 20, 
-            "PullUpdate"     : False, 
+            "PullUpdate"     : False,
+            "ServerPort"     : 8000, 
+            "ServerStyle"    : "", 
         }
         
         from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper
@@ -193,7 +195,7 @@
         if key in ["StopLogOnCopy", "UseLogBrowser", "PullUpdate"]:
             return Preferences.toBool(Preferences.Prefs.settings.value(
                 "Mercurial/" + key, self.__mercurialDefaults[key]))
-        elif key in ["LogLimit", "CommitMessages"]:
+        elif key in ["LogLimit", "CommitMessages", "ServerPort"]:
             return int(Preferences.Prefs.settings.value("Mercurial/" + key,
                 self.__mercurialDefaults[key]))
         elif key in ["Commits"]:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/VcsPlugins/vcsMercurial/HgServeDialog.py	Sat May 29 17:52:59 2010 +0200
@@ -0,0 +1,216 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2010 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog for the Mercurial server.
+"""
+
+import os
+
+from PyQt4.QtCore import QProcess, Qt, QSize
+from PyQt4.QtGui import QMainWindow, QAction, QToolBar, QPlainTextEdit, \
+    QMessageBox, QTextCursor, QBrush, QSpinBox, QComboBox
+
+from E5Gui.E5Application import e5App
+
+import UI.PixmapCache
+
+import Preferences
+
+class HgServeDialog(QMainWindow):
+    """
+    Class implementing a dialog for the Mercurial server.
+    """
+    def __init__(self, vcs, path, parent = None):
+        """
+        Constructor
+        
+        @param vcs reference to the vcs object
+        @param path path of the repository to serve (string)
+        @param parent reference to the parent widget (QWidget)
+        """
+        QMainWindow.__init__(self, parent)
+        
+        self.vcs = vcs
+        self.__repoPath = path
+        
+        self.__styles = ["paper", "coal", "gitweb", "monoblue", "spartan", ]
+        
+        self.__startAct = QAction(
+            UI.PixmapCache.getIcon(
+                os.path.join("VcsPlugins", "vcsMercurial", "icons", "startServer.png")), 
+            self.trUtf8("Start Server"), self) 
+        self.__startAct.triggered.connect(self.__startServer)
+        self.__stopAct = QAction(
+            UI.PixmapCache.getIcon(
+                os.path.join("VcsPlugins", "vcsMercurial", "icons", "stopServer.png")), 
+            self.trUtf8("Stop Server"), self) 
+        self.__stopAct.triggered.connect(self.__stopServer)
+        self.__browserAct = QAction(
+            UI.PixmapCache.getIcon("home.png"), 
+            self.trUtf8("Start Browser"), self) 
+        self.__browserAct.triggered.connect(self.__startBrowser)
+        
+        self.__portSpin = QSpinBox(self)
+        self.__portSpin.setMinimum(2048)
+        self.__portSpin.setMaximum(65535)
+        self.__portSpin.setToolTip(self.trUtf8("Enter the server port"))
+        self.__portSpin.setValue(self.vcs.getPlugin().getPreferences("ServerPort"))
+        
+        self.__styleCombo = QComboBox(self)
+        self.__styleCombo.addItems(self.__styles)
+        self.__styleCombo.setToolTip(self.trUtf8("Select the style to use"))
+        self.__styleCombo.setCurrentIndex(self.__styleCombo.findText(
+            self.vcs.getPlugin().getPreferences("ServerStyle")))
+        
+        self.__serverToolbar = QToolBar(self.trUtf8("Server"), self)
+        self.__serverToolbar.addAction(self.__startAct)
+        self.__serverToolbar.addAction(self.__stopAct)
+        self.__serverToolbar.addSeparator()
+        self.__serverToolbar.addWidget(self.__portSpin)
+        self.__serverToolbar.addWidget(self.__styleCombo)
+        
+        self.__browserToolbar = QToolBar(self.trUtf8("Browser"), self)
+        self.__browserToolbar.addAction(self.__browserAct)
+        
+        self.addToolBar(Qt.TopToolBarArea, self.__serverToolbar)
+        self.addToolBar(Qt.TopToolBarArea, self.__browserToolbar)
+        
+        self.__log = QPlainTextEdit(self)
+        self.setCentralWidget(self.__log)
+        
+        # polish up the dialog
+        self.__startAct.setEnabled(True)
+        self.__stopAct.setEnabled(False)
+        self.__browserAct.setEnabled(False)
+        self.__portSpin.setEnabled(True)
+        self.__styleCombo.setEnabled(True)
+        self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint()))
+        
+        self.process = QProcess()
+        self.process.finished.connect(self.__procFinished)
+        self.process.readyReadStandardOutput.connect(self.__readStdout)
+        self.process.readyReadStandardError.connect(self.__readStderr)
+        
+        self.cNormalFormat = self.__log.currentCharFormat()
+        self.cErrorFormat = self.__log.currentCharFormat()
+        self.cErrorFormat.setForeground(QBrush(Preferences.getUI("LogStdErrColour")))
+    
+    def __startServer(self):
+        """
+        Private slot to start the Mercurial server.
+        """
+        port = self.__portSpin.value()
+        style = self.__styleCombo.currentText()
+        
+        args = []
+        args.append("serve")
+        args.append("-v")
+        args.append("--port")
+        args.append(str(port))
+        args.append("--style")
+        args.append(style)
+        
+        self.process.setWorkingDirectory(self.__repoPath)
+        
+        self.process.start('hg', args)
+        procStarted = self.process.waitForStarted()
+        if procStarted:
+            self.__startAct.setEnabled(False)
+            self.__stopAct.setEnabled(True)
+            self.__browserAct.setEnabled(True)
+            self.__portSpin.setEnabled(False)
+            self.__styleCombo.setEnabled(False)
+            self.vcs.getPlugin().setPreferences("ServerPort", port)
+            self.vcs.getPlugin().setPreferences("ServerStyle", style)
+        else:
+            QMessageBox.critical(None,
+                self.trUtf8('Process Generation Error'),
+                self.trUtf8(
+                    'The process {0} could not be started. '
+                    'Ensure, that it is in the search path.'
+                ).format('hg'))
+    
+    def __stopServer(self):
+        """
+        Private slot to stop the Mercurial server.
+        """
+        if self.process is not None and \
+           self.process.state() != QProcess.NotRunning:
+            self.process.terminate()
+            self.process.waitForFinished(5000)
+            if self.process.state() != QProcess.NotRunning:
+                self.process.kill()
+        
+        self.__startAct.setEnabled(True)
+        self.__stopAct.setEnabled(False)
+        self.__browserAct.setEnabled(False)
+        self.__portSpin.setEnabled(True)
+        self.__styleCombo.setEnabled(True)
+    
+    def __startBrowser(self):
+        """
+        Private slot to start a browser for the served repository.
+        """
+        ui = e5App().getObject("UserInterface")
+        ui.launchHelpViewer("http://localhost:{0}".format(self.__portSpin.value()))
+    
+    def closeEvent(self, e):
+        """
+        Private slot implementing a close event handler.
+        
+        @param e close event (QCloseEvent)
+        """
+        self.__stopServer()
+    
+    def __procFinished(self, exitCode, exitStatus):
+        """
+        Private slot connected to the finished signal.
+        
+        @param exitCode exit code of the process (integer)
+        @param exitStatus exit status of the process (QProcess.ExitStatus)
+        """
+        self.__stopServer()
+    
+    def __readStdout(self):
+        """
+        Private slot to handle the readyReadStandardOutput signal. 
+        
+        It reads the output of the process and inserts it into the log.
+        """
+        if self.process is not None:
+            s = str(self.process.readAllStandardOutput(), 
+                     Preferences.getSystem("IOEncoding"), 
+                     'replace')
+            self.__appendText(s, False)
+    
+    def __readStderr(self):
+        """
+        Private slot to handle the readyReadStandardError signal.
+        
+        It reads the error output of the process and inserts it into the log.
+        """
+        if self.process is not None:
+            s = str(self.process.readAllStandardError(), 
+                     Preferences.getSystem("IOEncoding"), 
+                     'replace')
+            self.__appendText(s, True)
+    
+    def __appendText(self, txt, error = False):
+        """
+        Public method to append text to the end.
+        
+        @param txt text to insert (string)
+        @param error flag indicating to insert error text (boolean)
+        """
+        tc = self.__log.textCursor()
+        tc.movePosition(QTextCursor.End)
+        self.__log.setTextCursor(tc)
+        if error:
+            self.__log.setCurrentCharFormat(self.cErrorFormat)
+        else:
+            self.__log.setCurrentCharFormat(self.cNormalFormat)
+        self.__log.insertPlainText(txt)
+        self.__log.ensureCursorVisible()
--- a/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py	Sat May 29 15:26:00 2010 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py	Sat May 29 17:52:59 2010 +0200
@@ -731,6 +731,19 @@
         ))
         self.connect(self.hgBackoutAct, SIGNAL('triggered()'), self.__hgBackout)
         self.actions.append(self.hgBackoutAct)
+        
+        self.hgServeAct = E5Action(self.trUtf8('Serve project repository'),
+                self.trUtf8('Serve project repository...'),
+                0, 0, self, 'mercurial_serve')
+        self.hgServeAct.setStatusTip(self.trUtf8(
+            'Serve the project repository'
+        ))
+        self.hgServeAct.setWhatsThis(self.trUtf8(
+            """<b>Serve project repository</b>"""
+            """<p>This serves the project repository.</p>"""
+        ))
+        self.connect(self.hgServeAct, SIGNAL('triggered()'), self.__hgServe)
+        self.actions.append(self.hgServeAct)
     
     def initMenu(self, menu):
         """
@@ -762,6 +775,8 @@
         
         specialsMenu = QMenu(self.trUtf8("Specials"), menu)
         specialsMenu.addAction(self.hgPushForcedAct)
+        specialsMenu.addSeparator()
+        specialsMenu.addAction(self.hgServeAct)
         
         bundleMenu = QMenu(self.trUtf8("Changegroup Management"), menu)
         bundleMenu.addAction(self.hgBundleAct)
@@ -1042,3 +1057,9 @@
         Protected slot used to back out changes of a changeset.
         """
         self.vcs.hgBackout(self.project.ppath)
+    
+    def __hgServe(self):
+        """
+        Protected slot used to serve the project.
+        """
+        self.vcs.hgServe(self.project.ppath)
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat May 29 15:26:00 2010 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat May 29 17:52:59 2010 +0200
@@ -40,6 +40,7 @@
 from .HgCommandDialog import HgCommandDialog
 from .HgBundleDialog import HgBundleDialog
 from .HgBackoutDialog import HgBackoutDialog
+from .HgServeDialog import HgServeDialog
 
 from .ProjectBrowserHelper import HgProjectBrowserHelper
 
@@ -104,6 +105,7 @@
         self.tagbranchList = None
         self.annotate = None
         self.editor = None
+        self.serveDlg = None
         self.bundleFile = None
         
         self.statusCache = {}
@@ -135,6 +137,8 @@
             self.tagbranchList.close()
         if self.annotate is not None:
             self.annotate.close()
+        if self.serveDlg is not None:
+            self.serveDlg.close()
         
         if self.bundleFile and os.path.exists(self.bundleFile):
             os.remove(self.bundleFile)
@@ -1975,6 +1979,24 @@
             if res:
                 dia.exec_()
     
+    def hgServe(self, name):
+        """
+        Public method used to edit the repository config file.
+        
+        @param name directory name (string)
+        """
+        dname, fname = self.splitPath(name)
+        
+        # find the root of the repo
+        repodir = str(dname)
+        while not os.path.isdir(os.path.join(repodir, self.adminDir)):
+            repodir = os.path.dirname(repodir)
+            if repodir == os.sep:
+                return
+        
+        self.serveDlg = HgServeDialog(self, repodir)
+        self.serveDlg.show()
+    
     ############################################################################
     ## Methods to get the helper objects are below.
     ############################################################################
Binary file Plugins/VcsPlugins/vcsMercurial/icons/startServer.png has changed
Binary file Plugins/VcsPlugins/vcsMercurial/icons/stopServer.png has changed
--- a/changelog	Sat May 29 15:26:00 2010 +0200
+++ b/changelog	Sat May 29 17:52:59 2010 +0200
@@ -4,6 +4,7 @@
 - bug fixes
 - added an action to perform a 'hg push -f' to the Mercurial plug-in
 - added a handler for ftp: URLs to the web browser
+- added action to start a Mercurial server to the Mercurial plug-in
 
 Version 5.0-snapshot-20100523:
 - bug fixes
--- a/eric5.e4p	Sat May 29 15:26:00 2010 +0200
+++ b/eric5.e4p	Sat May 29 17:52:59 2010 +0200
@@ -802,6 +802,7 @@
     <Source>E5Network/E5NetworkProxyFactory.py</Source>
     <Source>Helpviewer/Network/FtpAccessHandler.py</Source>
     <Source>Helpviewer/Network/FtpReply.py</Source>
+    <Source>Plugins/VcsPlugins/vcsMercurial/HgServeDialog.py</Source>
   </Sources>
   <Forms>
     <Form>PyUnit/UnittestDialog.ui</Form>
@@ -1113,6 +1114,8 @@
     <Other>Plugins/VcsPlugins/vcsMercurial/styles/logDialog.style</Other>
     <Other>.hgignore</Other>
     <Other>patches</Other>
+    <Other>Plugins/VcsPlugins/vcsMercurial/icons/startServer.png</Other>
+    <Other>Plugins/VcsPlugins/vcsMercurial/icons/stopServer.png</Other>
   </Others>
   <MainScript>eric5.py</MainScript>
   <Vcs>

eric ide

mercurial