eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py

branch
eric7
changeset 8624
5192a2592324
parent 8621
8c9f41115c04
child 8881
54e42bc2437a
--- a/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py	Wed Sep 22 19:52:28 2021 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsPySvn/subversion.py	Thu Sep 23 18:20:31 2021 +0200
@@ -29,6 +29,7 @@
 from .SvnDialog import SvnDialog
 from .SvnUtilities import getConfigPath, amendConfig, createDefaultConfig
 
+import Preferences
 import Utilities
 
 
@@ -481,8 +482,7 @@
             # call CommitDialog and get message from there
             if self.__commitDialog is None:
                 from .SvnCommitDialog import SvnCommitDialog
-                self.__commitDialog = SvnCommitDialog(
-                    self.svnGetChangelists(), self.__ui)
+                self.__commitDialog = SvnCommitDialog(self, self.__ui)
                 self.__commitDialog.accepted.connect(self.__vcsCommit_Step2)
             self.__commitDialog.show()
             self.__commitDialog.raise_()
@@ -606,7 +606,45 @@
         os.chdir(cwd)
         self.committed.emit()
         self.checkVCSStatus()
+    
+    def vcsCommitMessages(self):
+        """
+        Public method to get the list of saved commit messages.
         
+        @return list of saved commit messages
+        @rtype list of str
+        """
+        # try per project commit history first
+        messages = self._vcsProjectCommitMessages()
+        if not messages:
+            # empty list returned, try the vcs specific one
+            messages = self.getPlugin().getPreferences("Commits")
+        
+        return messages
+    
+    def vcsAddCommitMessage(self, message):
+        """
+        Public method to add a commit message to the list of saved messages.
+        
+        @param message message to be added
+        @type str
+        """
+        if not self._vcsAddProjectCommitMessage(message):
+            commitMessages = self.vcsCommitMessages()
+            if message in commitMessages:
+                commitMessages.remove(message)
+            commitMessages.insert(0, message)
+            no = Preferences.getVCS("CommitMessages")
+            del commitMessages[no:]
+            self.getPlugin().setPreferences("Commits", commitMessages)
+    
+    def vcsClearCommitMessages(self):
+        """
+        Public method to clear the list of saved messages.
+        """
+        if not self._vcsClearProjectCommitMessages():
+            self.getPlugin().setPreferences('Commits', [])
+    
     def vcsUpdate(self, name, noDialog=False):
         """
         Public method used to update a file/directory with the Subversion

eric ide

mercurial