eric6/Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 7791
f07ded9bc64d
parent 7790
32b8db5a1fb4
child 7836
2f0d208b8137
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Oct 17 14:35:29 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Oct 17 15:18:47 2020 +0200
@@ -306,10 +306,8 @@
         if not msg:
             msg = '***'
         
-        # TODO: hg init has to be run with the hg command line client
         args = self.initCommand("init")
         args.append(projectDir)
-        # init is not possible with the command server
         dia = HgDialog(self.tr('Creating Mercurial repository'), self)
         res = dia.startProcess(args)
         if res:
@@ -317,6 +315,9 @@
         status = dia.normalExit()
         
         if status:
+            self.stopClient()
+            self.__repoDir = projectDir
+            
             ignoreName = os.path.join(projectDir, Hg.IgnoreFileName)
             if not os.path.exists(ignoreName):
                 status = self.hgCreateIgnoreFile(projectDir)
@@ -3379,9 +3380,7 @@
         @param repodir path of the local repository
         @type str
         """
-        if self.__client is not None:
-            self.__client.stopServer()
-            self.__client = None
+        self.stopClient()
         
         self.__client = HgClient(repodir, "utf-8", self)
         ok, err = self.__client.startServer()
@@ -3404,6 +3403,14 @@
         
         return self.__client
     
+    def stopClient(self):
+        """
+        Public method to stop the command server client.
+        """
+        if self.__client is not None:
+            self.__client.stopServer()
+            self.__client = None
+    
     ###########################################################################
     ##  Status Monitor Thread methods
     ###########################################################################

eric ide

mercurial