Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 2222
105f425944a2
parent 2094
88620e11c67c
child 2280
8e85ca3fabe7
diff -r f72f8b0478cb -r 105f425944a2 Plugins/VcsPlugins/vcsPySvn/subversion.py
--- a/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Nov 12 14:42:48 2012 +0100
+++ b/Plugins/VcsPlugins/vcsPySvn/subversion.py	Mon Nov 12 17:46:11 2012 +0100
@@ -495,6 +495,37 @@
         msg = self.__commitData["msg"]
         noDialog = self.__commitData["noDialog"]
         
+        if not noDialog:
+            # check, if there are unsaved changes, that should be committed
+            if isinstance(name, list):
+                nameList = name
+            else:
+                nameList = [name]
+            ok = True
+            for nam in nameList:
+                # check for commit of the project
+                if os.path.isdir(nam):
+                    project = e5App().getObject("Project")
+                    if nam == project.getProjectPath():
+                        ok &= project.checkAllScriptsDirty(reportSyntaxErrors=True) and \
+                              project.checkDirty()
+                        continue
+                elif os.path.isfile(nam):
+                    editor = e5App().getObject("ViewManager").getOpenEditor(nam)
+                    if editor:
+                       ok &= editor.checkDirty()
+                if not ok:
+                    break
+            
+            if not ok:
+                res = E5MessageBox.yesNo(self.__ui,
+                    self.trUtf8("Commit Changes"),
+                    self.trUtf8("""The commit affects files, that have unsaved"""
+                                """ changes. Shall the commit be continued?"""),
+                    icon = E5MessageBox.Warning)
+                if not res:
+                    return
+        
         if self.__commitDialog is not None:
             msg = self.__commitDialog.logMessage()
             if self.__commitDialog.hasChangelists():

eric ide

mercurial