463 """ |
463 """ |
464 name = self.__commitData["name"] |
464 name = self.__commitData["name"] |
465 msg = self.__commitData["msg"] |
465 msg = self.__commitData["msg"] |
466 noDialog = self.__commitData["noDialog"] |
466 noDialog = self.__commitData["noDialog"] |
467 |
467 |
|
468 if not noDialog: |
|
469 # check, if there are unsaved changes, that should be committed |
|
470 if isinstance(name, list): |
|
471 nameList = name |
|
472 else: |
|
473 nameList = [name] |
|
474 ok = True |
|
475 for nam in nameList: |
|
476 # check for commit of the project |
|
477 if os.path.isdir(nam): |
|
478 project = e5App().getObject("Project") |
|
479 if nam == project.getProjectPath(): |
|
480 ok &= project.checkAllScriptsDirty(reportSyntaxErrors=True) and \ |
|
481 project.checkDirty() |
|
482 continue |
|
483 elif os.path.isfile(nam): |
|
484 editor = e5App().getObject("ViewManager").getOpenEditor(nam) |
|
485 if editor: |
|
486 ok &= editor.checkDirty() |
|
487 if not ok: |
|
488 break |
|
489 |
|
490 if not ok: |
|
491 res = E5MessageBox.yesNo(self.__ui, |
|
492 self.trUtf8("Commit Changes"), |
|
493 self.trUtf8("""The commit affects files, that have unsaved""" |
|
494 """ changes. Shall the commit be continued?"""), |
|
495 icon = E5MessageBox.Warning) |
|
496 if not res: |
|
497 return |
|
498 |
468 if self.__commitDialog is not None: |
499 if self.__commitDialog is not None: |
469 msg = self.__commitDialog.logMessage() |
500 msg = self.__commitDialog.logMessage() |
470 if self.__commitDialog.hasChangelists(): |
501 if self.__commitDialog.hasChangelists(): |
471 changelists, keepChangelists = self.__commitDialog.changelistsData() |
502 changelists, keepChangelists = self.__commitDialog.changelistsData() |
472 else: |
503 else: |