VCS: extended the vcsImport function.

Sat, 24 Aug 2019 18:26:11 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 24 Aug 2019 18:26:11 +0200
changeset 7167
b3557e77314a
parent 7166
5a184952ba77
child 7168
c1f97706c905

VCS: extended the vcsImport function.

eric6/Plugins/VcsPlugins/vcsGit/git.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py file | annotate | diff | comparison | revisions
eric6/VCS/VersionControl.py file | annotate | diff | comparison | revisions
--- a/eric6/Plugins/VcsPlugins/vcsGit/git.py	Sat Aug 24 18:25:37 2019 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/git.py	Sat Aug 24 18:26:11 2019 +0200
@@ -233,15 +233,19 @@
         """
         return True
     
-    def vcsConvertProject(self, vcsDataDict, project):
+    def vcsConvertProject(self, vcsDataDict, project, addAll=True):
         """
         Public method to convert an uncontrolled project to a version
         controlled project.
         
         @param vcsDataDict dictionary of data required for the conversion
+        @type dict
         @param project reference to the project object
-        """
-        success = self.vcsImport(vcsDataDict, project.ppath)[0]
+        @type Project
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        """
+        success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0]
         if not success:
             E5MessageBox.critical(
                 self.__ui,
@@ -255,15 +259,21 @@
             project.closeProject()
             project.openProject(pfn)
     
-    def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
+    def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
         """
         Public method used to import the project into the Git repository.
         
         @param vcsDataDict dictionary of data required for the import
+        @type dict
         @param projectDir project directory (string)
+        @type str
         @param noDialog flag indicating quiet operations
-        @return flag indicating an execution without errors (boolean)
-            and a flag indicating the version controll status (boolean)
+        @type bool
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        @return tuple containing a flag indicating an execution without errors
+            and a flag indicating the version controll status
+        @rtype tuple of (bool, bool)
         """
         msg = vcsDataDict["message"]
         if not msg:
@@ -282,7 +292,7 @@
             if not os.path.exists(ignoreName):
                 status = self.gitCreateIgnoreFile(projectDir)
             
-            if status:
+            if status and addAll:
                 args = self.initCommand("add")
                 args.append("-v")
                 args.append(".")
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Aug 24 18:25:37 2019 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Aug 24 18:26:11 2019 +0200
@@ -273,15 +273,19 @@
         """
         return True
     
-    def vcsConvertProject(self, vcsDataDict, project):
+    def vcsConvertProject(self, vcsDataDict, project, addAll=True):
         """
         Public method to convert an uncontrolled project to a version
         controlled project.
         
         @param vcsDataDict dictionary of data required for the conversion
+        @type dict
         @param project reference to the project object
+        @type Project
+        @param addAll flag indicating to add all files to the repository
+        @type bool
         """
-        success = self.vcsImport(vcsDataDict, project.ppath)[0]
+        success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0]
         if not success:
             E5MessageBox.critical(
                 self.__ui,
@@ -295,15 +299,21 @@
             project.closeProject()
             project.openProject(pfn)
     
-    def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
+    def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
         """
         Public method used to import the project into the Mercurial repository.
         
         @param vcsDataDict dictionary of data required for the import
+        @type dict
         @param projectDir project directory (string)
+        @type str
         @param noDialog flag indicating quiet operations
-        @return flag indicating an execution without errors (boolean)
-            and a flag indicating the version controll status (boolean)
+        @type bool
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        @return tuple containing a flag indicating an execution without errors
+            and a flag indicating the version controll status
+        @rtype tuple of (bool, bool)
         """
         msg = vcsDataDict["message"]
         if not msg:
@@ -323,7 +333,7 @@
             if not os.path.exists(ignoreName):
                 status = self.hgCreateIgnoreFile(projectDir)
             
-            if status:
+            if status and addAll:
                 args = self.initCommand("commit")
                 args.append('--addremove')
                 args.append('--message')
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py	Sat Aug 24 18:25:37 2019 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py	Sat Aug 24 18:26:11 2019 +0200
@@ -190,15 +190,19 @@
         """
         return True
         
-    def vcsConvertProject(self, vcsDataDict, project):
+    def vcsConvertProject(self, vcsDataDict, project, addAll=True):
         """
         Public method to convert an uncontrolled project to a version
         controlled project.
         
         @param vcsDataDict dictionary of data required for the conversion
+        @type dict
         @param project reference to the project object
+        @type Project
+        @param addAll flag indicating to add all files to the repository
+        @type bool
         """
-        success = self.vcsImport(vcsDataDict, project.ppath)[0]
+        success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0]
         if not success:
             E5MessageBox.critical(
                 self.__ui,
@@ -248,16 +252,22 @@
             project.closeProject(noSave=True)
             project.openProject(pfn)
         
-    def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
+    def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
         """
         Public method used to import the project into the Subversion
         repository.
         
         @param vcsDataDict dictionary of data required for the import
+        @type dict
         @param projectDir project directory (string)
+        @type str
         @param noDialog flag indicating quiet operations
-        @return flag indicating an execution without errors (boolean)
-            and a flag indicating the version controll status (boolean)
+        @type bool
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        @return tuple containing a flag indicating an execution without errors
+            and a flag indicating the version controll status
+        @rtype tuple of (bool, bool)
         """
         noDialog = False
         msg = vcsDataDict["message"]
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py	Sat Aug 24 18:25:37 2019 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/subversion.py	Sat Aug 24 18:26:11 2019 +0200
@@ -203,15 +203,19 @@
         """
         return True
         
-    def vcsConvertProject(self, vcsDataDict, project):
+    def vcsConvertProject(self, vcsDataDict, project, addAll=True):
         """
         Public method to convert an uncontrolled project to a version
         controlled project.
         
         @param vcsDataDict dictionary of data required for the conversion
+        @type dict
         @param project reference to the project object
+        @type Project
+        @param addAll flag indicating to add all files to the repository
+        @type bool
         """
-        success = self.vcsImport(vcsDataDict, project.ppath)[0]
+        success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0]
         if not success:
             E5MessageBox.critical(
                 self.__ui,
@@ -261,16 +265,22 @@
             project.closeProject(noSave=True)
             project.openProject(pfn)
         
-    def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
+    def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
         """
         Public method used to import the project into the Subversion
         repository.
         
         @param vcsDataDict dictionary of data required for the import
+        @type dict
         @param projectDir project directory (string)
+        @type str
         @param noDialog flag indicating quiet operations
-        @return flag indicating an execution without errors (boolean)
-            and a flag indicating the version control status (boolean)
+        @type bool
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        @return tuple containing a flag indicating an execution without errors
+            and a flag indicating the version controll status
+        @rtype tuple of (bool, bool)
         """
         noDialog = False
         msg = vcsDataDict["message"]
--- a/eric6/VCS/VersionControl.py	Sat Aug 24 18:25:37 2019 +0200
+++ b/eric6/VCS/VersionControl.py	Sat Aug 24 18:26:11 2019 +0200
@@ -90,7 +90,7 @@
         """
         Public method used to test for the presence of the vcs.
         
-        @ireturn tuple of flag indicating the existence and a string
+        @return tuple of flag indicating the existence and a string
             giving an error message in case of failure
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
@@ -103,33 +103,43 @@
         
         @param vcsDir name of the VCS directory (string)
         @param noDialog flag indicating quiet operations (boolean)
-        @ireturn flag indicating success (boolean)
+        @return flag indicating success (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
         raise RuntimeError('Not implemented')
         
-    def vcsConvertProject(self, vcsDataDict, project):
+    def vcsConvertProject(self, vcsDataDict, project, addAll=True):
         """
         Public method to convert an uncontrolled project to a version
         controlled project.
         
         @param vcsDataDict dictionary of data required for the conversion
+        @type dict
         @param project reference to the project object
+        @type Project
+        @param addAll flag indicating to add all files to the repository
+        @type bool
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
         raise RuntimeError('Not implemented')
         
-    def vcsImport(self, vcsDataDict, projectDir, noDialog=False):
+    def vcsImport(self, vcsDataDict, projectDir, noDialog=False, addAll=True):
         """
         Public method used to import the project into the vcs.
         
         @param vcsDataDict dictionary of data required for the import
+        @type dict
         @param projectDir project directory (string)
+        @type str
         @param noDialog flag indicating quiet operations
-        @ireturn flag indicating an execution without errors (boolean)
-            and a flag indicating the version controll status (boolean)
+        @type bool
+        @param addAll flag indicating to add all files to the repository
+        @type bool
+        @return tuple containing a flag indicating an execution without errors
+            and a flag indicating the version controll status
+        @rtype tuple of (bool, bool)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -142,7 +152,7 @@
         @param vcsDataDict dictionary of data required for the checkout
         @param projectDir project directory to create (string)
         @param noDialog flag indicating quiet operations
-        @ireturn flag indicating an execution without errors (boolean)
+        @return flag indicating an execution without errors (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -154,7 +164,7 @@
         
         @param vcsDataDict dictionary of data required for the export
         @param projectDir project directory to create (string)
-        @ireturn flag indicating an execution without errors (boolean)
+        @return flag indicating an execution without errors (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -168,7 +178,7 @@
         @param name file/directory name to be committed (string)
         @param message message for this operation (string)
         @param noDialog flag indicating quiet operations (boolean)
-        @ireturn flag indicating success (boolean)
+        @return flag indicating success (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -180,7 +190,7 @@
         
         @param name file/directory name to be updated (string)
         @param noDialog flag indicating quiet operations (boolean)
-        @ireturn flag indicating, that the update contained an add
+        @return flag indicating, that the update contained an add
             or delete (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
@@ -227,7 +237,7 @@
         @param name file/directory name to be removed (string)
         @param project flag indicating deletion of a project tree (boolean)
         @param noDialog flag indicating quiet operations
-        @ireturn flag indicating success (boolean)
+        @return flag indicating success (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -241,7 +251,7 @@
         @param project reference to the project object
         @param target new name of the file/directory (string)
         @param noDialog flag indicating quiet operations
-        @ireturn flag indicating successfull operation (boolean)
+        @return flag indicating successfull operation (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -305,7 +315,7 @@
         Public method used to switch a directory to a different tag/branch.
         
         @param name directory name to be switched (string)
-        @ireturn flag indicating, that the switch contained an add
+        @return flag indicating, that the switch contained an add
             or delete (boolean)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
@@ -327,7 +337,7 @@
         Public method used to get the registered state of a file in the vcs.
         
         @param name filename to check (string)
-        @ireturn a combination of canBeCommited and canBeAdded or
+        @return a combination of canBeCommited and canBeAdded or
             0 in order to signal an error
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
@@ -341,7 +351,7 @@
         
         @param names dictionary with all filenames to be checked as keys
         @param dname directory to check in (string)
-        @ireturn the received dictionary completed with a combination of
+        @return the received dictionary completed with a combination of
             canBeCommited and canBeAdded or None in order to signal an error
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
@@ -352,7 +362,7 @@
         """
         Public method returning the name of the vcs.
         
-        @ireturn name of the vcs (string)
+        @return name of the vcs (string)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -408,7 +418,7 @@
         Public method to retrieve information about the repository.
         
         @param ppath local path to get the repository infos (string)
-        @ireturn string with ready formated info for display (string)
+        @return string with ready formated info for display (string)
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -424,7 +434,7 @@
         @param project reference to the project object
         @param isTranslationsBrowser flag indicating, the helper is requested
             for the translations browser (this needs some special treatment)
-        @ireturn the project browser helper object
+        @return the project browser helper object
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """
@@ -435,7 +445,7 @@
         Public method to instanciate a helper object for the project.
         
         @param project reference to the project object
-        @ireturn the project helper object
+        @return the project helper object
         @exception RuntimeError to indicate that this method must be
             implemented by a subclass
         """

eric ide

mercurial