VCS/ProjectHelper: added some code to cope against vcs being None. maintenance

Sat, 02 Jan 2021 17:28:57 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 02 Jan 2021 17:28:57 +0100
branch
maintenance
changeset 7942
049ef800208f
parent 7940
5c1057897164
child 7943
cbe676f46e4e

VCS/ProjectHelper: added some code to cope against vcs being None.
(grafted from cf988a30ba475903caa04ad9425a4e96bb8262ad)

eric6/VCS/ProjectHelper.py file | annotate | diff | comparison | revisions
--- a/eric6/VCS/ProjectHelper.py	Sat Jan 02 15:28:23 2021 +0100
+++ b/eric6/VCS/ProjectHelper.py	Sat Jan 02 17:28:57 2021 +0100
@@ -463,6 +463,10 @@
         """
         Protected slot used to update the local project from the repository.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         shouldReopen = self.vcs.vcsUpdate(self.project.ppath)
         if shouldReopen:
             res = E5MessageBox.yesNo(
@@ -480,6 +484,10 @@
         Protected slot used to commit changes to the local project to the
         repository.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         if Preferences.getVCS("AutoSaveProject"):
             self.project.saveProject()
         if Preferences.getVCS("AutoSaveFiles"):
@@ -493,6 +501,10 @@
         Depending on the parameters set in the vcs object the project
         may be removed from the local disk as well.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         res = E5MessageBox.yesNo(
             self.parent(),
             QCoreApplication.translate(
@@ -515,6 +527,10 @@
         """
         Protected slot to edit the VCS command options.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         if self.vcs.vcsSupportCommandOptions():
             from .CommandOptionsDialog import VcsCommandOptionsDialog
             codlg = VcsCommandOptionsDialog(self.vcs)
@@ -534,6 +550,10 @@
         Protected slot used to show the log of the local project with a
         log browser dialog.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsLogBrowser(self.project.ppath)
         
     def _vcsDiff(self):
@@ -541,30 +561,50 @@
         Protected slot used to show the difference of the local project to
         the repository.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsDiff(self.project.ppath)
         
     def _vcsStatus(self):
         """
         Protected slot used to show the status of the local project.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsStatus(self.project.ppath)
         
     def _vcsTag(self):
         """
         Protected slot used to tag the local project in the repository.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsTag(self.project.ppath)
         
     def _vcsRevert(self):
         """
         Protected slot used to revert changes made to the local project.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsRevert(self.project.ppath)
         
     def _vcsSwitch(self):
         """
         Protected slot used to switch the local project to another tag/branch.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         shouldReopen = self.vcs.vcsSwitch(self.project.ppath)
         if shouldReopen:
             res = E5MessageBox.yesNo(
@@ -582,24 +622,40 @@
         Protected slot used to merge changes of a tag/revision into the local
         project.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsMerge(self.project.ppath)
         
     def _vcsCleanup(self):
         """
         Protected slot used to cleanup the local project.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsCleanup(self.project.ppath)
         
     def _vcsCommand(self):
         """
         Protected slot used to execute an arbitrary vcs command.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         self.vcs.vcsCommandLine(self.project.ppath)
 
     def _vcsInfoDisplay(self):
         """
         Protected slot called to show some vcs information.
         """
+        if self.vcs is None:
+            # just in case
+            return
+        
         from .RepositoryInfoDialog import VcsRepositoryInfoDialog
         info = self.vcs.vcsRepositoryInfos(self.project.ppath)
         dlg = VcsRepositoryInfoDialog(None, info)

eric ide

mercurial