14 from PyQt6.QtCore import ( |
14 from PyQt6.QtCore import ( |
15 pyqtSignal, QFileInfo, QFileSystemWatcher, QCoreApplication |
15 pyqtSignal, QFileInfo, QFileSystemWatcher, QCoreApplication |
16 ) |
16 ) |
17 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog |
17 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog |
18 |
18 |
19 from E5Gui.E5Application import e5App |
19 from E5Gui.EricApplication import ericApp |
20 from E5Gui import E5MessageBox, E5FileDialog |
20 from E5Gui import EricMessageBox, EricFileDialog |
21 |
21 |
22 from QScintilla.MiniEditor import MiniEditor |
22 from QScintilla.MiniEditor import MiniEditor |
23 |
23 |
24 from VCS.VersionControl import VersionControl |
24 from VCS.VersionControl import VersionControl |
25 from VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog |
25 from VCS.RepositoryInfoDialog import VcsRepositoryInfoDialog |
273 @param addAll flag indicating to add all files to the repository |
273 @param addAll flag indicating to add all files to the repository |
274 @type bool |
274 @type bool |
275 """ |
275 """ |
276 success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0] |
276 success = self.vcsImport(vcsDataDict, project.ppath, addAll=addAll)[0] |
277 if not success: |
277 if not success: |
278 E5MessageBox.critical( |
278 EricMessageBox.critical( |
279 self.__ui, |
279 self.__ui, |
280 self.tr("Create project repository"), |
280 self.tr("Create project repository"), |
281 self.tr( |
281 self.tr( |
282 """The project repository could not be created.""")) |
282 """The project repository could not be created.""")) |
283 else: |
283 else: |
450 nameList = [name] |
450 nameList = [name] |
451 ok = True |
451 ok = True |
452 for nam in nameList: |
452 for nam in nameList: |
453 # check for commit of the project |
453 # check for commit of the project |
454 if os.path.isdir(nam): |
454 if os.path.isdir(nam): |
455 project = e5App().getObject("Project") |
455 project = ericApp().getObject("Project") |
456 if nam == project.getProjectPath(): |
456 if nam == project.getProjectPath(): |
457 ok &= ( |
457 ok &= ( |
458 project.checkAllScriptsDirty( |
458 project.checkAllScriptsDirty( |
459 reportSyntaxErrors=True) and |
459 reportSyntaxErrors=True) and |
460 project.checkDirty() |
460 project.checkDirty() |
461 ) |
461 ) |
462 continue |
462 continue |
463 elif os.path.isfile(nam): |
463 elif os.path.isfile(nam): |
464 editor = ( |
464 editor = ( |
465 e5App().getObject("ViewManager").getOpenEditor(nam) |
465 ericApp().getObject("ViewManager").getOpenEditor(nam) |
466 ) |
466 ) |
467 if editor: |
467 if editor: |
468 ok &= editor.checkDirty() |
468 ok &= editor.checkDirty() |
469 if not ok: |
469 if not ok: |
470 break |
470 break |
471 |
471 |
472 if not ok: |
472 if not ok: |
473 res = E5MessageBox.yesNo( |
473 res = EricMessageBox.yesNo( |
474 self.__ui, |
474 self.__ui, |
475 self.tr("Commit Changes"), |
475 self.tr("Commit Changes"), |
476 self.tr( |
476 self.tr( |
477 """The commit affects files, that have unsaved""" |
477 """The commit affects files, that have unsaved""" |
478 """ changes. Shall the commit be continued?"""), |
478 """ changes. Shall the commit be continued?"""), |
479 icon=E5MessageBox.Warning) |
479 icon=EricMessageBox.Warning) |
480 if not res: |
480 if not res: |
481 return |
481 return |
482 |
482 |
483 if self.__commitDialog is not None: |
483 if self.__commitDialog is not None: |
484 (msg, amend, commitSubrepositories, author, |
484 (msg, amend, commitSubrepositories, author, |
534 res = dia.startProcess(args) |
534 res = dia.startProcess(args) |
535 if res: |
535 if res: |
536 dia.exec() |
536 dia.exec() |
537 self.committed.emit() |
537 self.committed.emit() |
538 if self.__forgotNames: |
538 if self.__forgotNames: |
539 model = e5App().getObject("Project").getModel() |
539 model = ericApp().getObject("Project").getModel() |
540 for name in self.__forgotNames: |
540 for name in self.__forgotNames: |
541 model.updateVCSStatus(name) |
541 model.updateVCSStatus(name) |
542 self.__forgotNames = [] |
542 self.__forgotNames = [] |
543 self.checkVCSStatus() |
543 self.checkVCSStatus() |
544 |
544 |
749 @param name file/directory name to be diffed (string) |
749 @param name file/directory name to be diffed (string) |
750 """ |
750 """ |
751 names = name[:] if isinstance(name, list) else [name] |
751 names = name[:] if isinstance(name, list) else [name] |
752 for nam in names: |
752 for nam in names: |
753 if os.path.isfile(nam): |
753 if os.path.isfile(nam): |
754 editor = e5App().getObject("ViewManager").getOpenEditor(nam) |
754 editor = ericApp().getObject("ViewManager").getOpenEditor(nam) |
755 if editor and not editor.checkDirty(): |
755 if editor and not editor.checkDirty(): |
756 return |
756 return |
757 else: |
757 else: |
758 project = e5App().getObject("Project") |
758 project = ericApp().getObject("Project") |
759 if nam == project.ppath and not project.saveAllScripts(): |
759 if nam == project.ppath and not project.saveAllScripts(): |
760 return |
760 return |
761 if self.diff is None: |
761 if self.diff is None: |
762 from .HgDiffDialog import HgDiffDialog |
762 from .HgDiffDialog import HgDiffDialog |
763 self.diff = HgDiffDialog(self) |
763 self.diff = HgDiffDialog(self) |
881 "Do you really want to revert all changes to these files" |
881 "Do you really want to revert all changes to these files" |
882 " or directories?"), |
882 " or directories?"), |
883 names) |
883 names) |
884 yes = dlg.exec() == QDialog.DialogCode.Accepted |
884 yes = dlg.exec() == QDialog.DialogCode.Accepted |
885 else: |
885 else: |
886 yes = E5MessageBox.yesNo( |
886 yes = EricMessageBox.yesNo( |
887 None, |
887 None, |
888 self.tr("Revert changes"), |
888 self.tr("Revert changes"), |
889 self.tr("""Do you really want to revert all changes of""" |
889 self.tr("""Do you really want to revert all changes of""" |
890 """ the project?""")) |
890 """ the project?""")) |
891 if yes: |
891 if yes: |
967 "Do you really want to re-merge these files" |
967 "Do you really want to re-merge these files" |
968 " or directories?"), |
968 " or directories?"), |
969 names) |
969 names) |
970 yes = dlg.exec() == QDialog.DialogCode.Accepted |
970 yes = dlg.exec() == QDialog.DialogCode.Accepted |
971 else: |
971 else: |
972 yes = E5MessageBox.yesNo( |
972 yes = EricMessageBox.yesNo( |
973 None, |
973 None, |
974 self.tr("Re-Merge"), |
974 self.tr("Re-Merge"), |
975 self.tr("""Do you really want to re-merge the project?""")) |
975 self.tr("""Do you really want to re-merge the project?""")) |
976 if yes: |
976 if yes: |
977 dia = HgDialog(self.tr('Re-Merging').format(name), self) |
977 dia = HgDialog(self.tr('Re-Merging').format(name), self) |
1451 @param name file/directory name to be diffed (string) |
1451 @param name file/directory name to be diffed (string) |
1452 """ |
1452 """ |
1453 names = name[:] if isinstance(name, list) else [name] |
1453 names = name[:] if isinstance(name, list) else [name] |
1454 for nam in names: |
1454 for nam in names: |
1455 if os.path.isfile(nam): |
1455 if os.path.isfile(nam): |
1456 editor = e5App().getObject("ViewManager").getOpenEditor(nam) |
1456 editor = ericApp().getObject("ViewManager").getOpenEditor(nam) |
1457 if editor and not editor.checkDirty(): |
1457 if editor and not editor.checkDirty(): |
1458 return |
1458 return |
1459 else: |
1459 else: |
1460 project = e5App().getObject("Project") |
1460 project = ericApp().getObject("Project") |
1461 if nam == project.ppath and not project.saveAllScripts(): |
1461 if nam == project.ppath and not project.saveAllScripts(): |
1462 return |
1462 return |
1463 |
1463 |
1464 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1464 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1465 dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), |
1465 dlg = HgRevisionsSelectionDialog(self.hgGetTagsList(), |
1521 else: |
1521 else: |
1522 rev1, rev2 = "", "" |
1522 rev1, rev2 = "", "" |
1523 |
1523 |
1524 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1524 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1525 if error: |
1525 if error: |
1526 E5MessageBox.critical( |
1526 EricMessageBox.critical( |
1527 self.__ui, |
1527 self.__ui, |
1528 self.tr("Mercurial Side-by-Side Difference"), |
1528 self.tr("Mercurial Side-by-Side Difference"), |
1529 error) |
1529 error) |
1530 return |
1530 return |
1531 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1531 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1532 |
1532 |
1533 if rev2: |
1533 if rev2: |
1534 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1534 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1535 if error: |
1535 if error: |
1536 E5MessageBox.critical( |
1536 EricMessageBox.critical( |
1537 self.__ui, |
1537 self.__ui, |
1538 self.tr("Mercurial Side-by-Side Difference"), |
1538 self.tr("Mercurial Side-by-Side Difference"), |
1539 error) |
1539 error) |
1540 return |
1540 return |
1541 name2 = "{0} (rev. {1})".format(name, rev2) |
1541 name2 = "{0} (rev. {1})".format(name, rev2) |
1543 try: |
1543 try: |
1544 with open(name, "r", encoding="utf-8") as f1: |
1544 with open(name, "r", encoding="utf-8") as f1: |
1545 output2 = f1.read() |
1545 output2 = f1.read() |
1546 name2 = "{0} (Work)".format(name) |
1546 name2 = "{0} (Work)".format(name) |
1547 except OSError: |
1547 except OSError: |
1548 E5MessageBox.critical( |
1548 EricMessageBox.critical( |
1549 self.__ui, |
1549 self.__ui, |
1550 self.tr("Mercurial Side-by-Side Difference"), |
1550 self.tr("Mercurial Side-by-Side Difference"), |
1551 self.tr( |
1551 self.tr( |
1552 """<p>The file <b>{0}</b> could not be read.</p>""") |
1552 """<p>The file <b>{0}</b> could not be read.</p>""") |
1553 .format(name)) |
1553 .format(name)) |
2020 "glob:**.DS_Store", |
2020 "glob:**.DS_Store", |
2021 ] |
2021 ] |
2022 |
2022 |
2023 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2023 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2024 res = ( |
2024 res = ( |
2025 E5MessageBox.yesNo( |
2025 EricMessageBox.yesNo( |
2026 self.__ui, |
2026 self.__ui, |
2027 self.tr("Create .hgignore file"), |
2027 self.tr("Create .hgignore file"), |
2028 self.tr("""<p>The file <b>{0}</b> exists already.""" |
2028 self.tr("""<p>The file <b>{0}</b> exists already.""" |
2029 """ Overwrite it?</p>""").format(ignoreName), |
2029 """ Overwrite it?</p>""").format(ignoreName), |
2030 icon=E5MessageBox.Warning) |
2030 icon=EricMessageBox.Warning) |
2031 if os.path.exists(ignoreName) else |
2031 if os.path.exists(ignoreName) else |
2032 True |
2032 True |
2033 ) |
2033 ) |
2034 if res: |
2034 if res: |
2035 try: |
2035 try: |
2041 except OSError: |
2041 except OSError: |
2042 status = False |
2042 status = False |
2043 |
2043 |
2044 if status and autoAdd: |
2044 if status and autoAdd: |
2045 self.vcsAdd(ignoreName, noDialog=True) |
2045 self.vcsAdd(ignoreName, noDialog=True) |
2046 project = e5App().getObject("Project") |
2046 project = ericApp().getObject("Project") |
2047 project.appendFile(ignoreName) |
2047 project.appendFile(ignoreName) |
2048 |
2048 |
2049 return status |
2049 return status |
2050 |
2050 |
2051 def hgBundle(self, bundleData=None): |
2051 def hgBundle(self, bundleData=None): |
2072 else: |
2072 else: |
2073 baseRevs = [] |
2073 baseRevs = [] |
2074 compression = "" |
2074 compression = "" |
2075 bundleAll = bundleData["all"] |
2075 bundleAll = bundleData["all"] |
2076 |
2076 |
2077 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2077 fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
2078 None, |
2078 None, |
2079 self.tr("Create changegroup"), |
2079 self.tr("Create changegroup"), |
2080 self.__lastChangeGroupPath, |
2080 self.__lastChangeGroupPath, |
2081 self.tr("Mercurial Changegroup Files (*.hg)"), |
2081 self.tr("Mercurial Changegroup Files (*.hg)"), |
2082 None, |
2082 None, |
2083 E5FileDialog.DontConfirmOverwrite) |
2083 EricFileDialog.DontConfirmOverwrite) |
2084 |
2084 |
2085 if not fname: |
2085 if not fname: |
2086 return # user aborted |
2086 return # user aborted |
2087 |
2087 |
2088 ext = QFileInfo(fname).suffix() |
2088 ext = QFileInfo(fname).suffix() |
2089 if not ext: |
2089 if not ext: |
2090 ex = selectedFilter.split("(*")[1].split(")")[0] |
2090 ex = selectedFilter.split("(*")[1].split(")")[0] |
2091 if ex: |
2091 if ex: |
2092 fname += ex |
2092 fname += ex |
2093 if QFileInfo(fname).exists(): |
2093 if QFileInfo(fname).exists(): |
2094 res = E5MessageBox.yesNo( |
2094 res = EricMessageBox.yesNo( |
2095 self.__ui, |
2095 self.__ui, |
2096 self.tr("Create changegroup"), |
2096 self.tr("Create changegroup"), |
2097 self.tr("<p>The Mercurial changegroup file <b>{0}</b> " |
2097 self.tr("<p>The Mercurial changegroup file <b>{0}</b> " |
2098 "already exists. Overwrite it?</p>") |
2098 "already exists. Overwrite it?</p>") |
2099 .format(fname), |
2099 .format(fname), |
2100 icon=E5MessageBox.Warning) |
2100 icon=EricMessageBox.Warning) |
2101 if not res: |
2101 if not res: |
2102 return |
2102 return |
2103 fname = Utilities.toNativeSeparators(fname) |
2103 fname = Utilities.toNativeSeparators(fname) |
2104 self.__lastChangeGroupPath = os.path.dirname(fname) |
2104 self.__lastChangeGroupPath = os.path.dirname(fname) |
2105 |
2105 |
2125 def hgPreviewBundle(self): |
2125 def hgPreviewBundle(self): |
2126 """ |
2126 """ |
2127 Public method used to view the log of incoming changes from a |
2127 Public method used to view the log of incoming changes from a |
2128 changegroup file. |
2128 changegroup file. |
2129 """ |
2129 """ |
2130 file = E5FileDialog.getOpenFileName( |
2130 file = EricFileDialog.getOpenFileName( |
2131 None, |
2131 None, |
2132 self.tr("Preview changegroup"), |
2132 self.tr("Preview changegroup"), |
2133 self.__lastChangeGroupPath, |
2133 self.__lastChangeGroupPath, |
2134 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2134 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2135 if file: |
2135 if file: |
2153 or delete |
2153 or delete |
2154 @rtype bool |
2154 @rtype bool |
2155 """ |
2155 """ |
2156 res = False |
2156 res = False |
2157 if not files: |
2157 if not files: |
2158 files = E5FileDialog.getOpenFileNames( |
2158 files = EricFileDialog.getOpenFileNames( |
2159 None, |
2159 None, |
2160 self.tr("Apply changegroups"), |
2160 self.tr("Apply changegroups"), |
2161 self.__lastChangeGroupPath, |
2161 self.__lastChangeGroupPath, |
2162 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2162 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2163 |
2163 |
2164 if files: |
2164 if files: |
2165 self.__lastChangeGroupPath = os.path.dirname(files[0]) |
2165 self.__lastChangeGroupPath = os.path.dirname(files[0]) |
2166 |
2166 |
2167 update = E5MessageBox.yesNo( |
2167 update = EricMessageBox.yesNo( |
2168 self.__ui, |
2168 self.__ui, |
2169 self.tr("Apply changegroups"), |
2169 self.tr("Apply changegroups"), |
2170 self.tr("""Shall the working directory be updated?"""), |
2170 self.tr("""Shall the working directory be updated?"""), |
2171 yesDefault=True) |
2171 yesDefault=True) |
2172 |
2172 |
2259 self.hgGetBranchesList(), |
2259 self.hgGetBranchesList(), |
2260 self.hgGetBookmarksList()) |
2260 self.hgGetBookmarksList()) |
2261 if dlg.exec() == QDialog.DialogCode.Accepted: |
2261 if dlg.exec() == QDialog.DialogCode.Accepted: |
2262 rev, merge, date, user, message = dlg.getParameters() |
2262 rev, merge, date, user, message = dlg.getParameters() |
2263 if not rev: |
2263 if not rev: |
2264 E5MessageBox.warning( |
2264 EricMessageBox.warning( |
2265 self.__ui, |
2265 self.__ui, |
2266 self.tr("Backing out changeset"), |
2266 self.tr("Backing out changeset"), |
2267 self.tr("""No revision given. Aborting...""")) |
2267 self.tr("""No revision given. Aborting...""")) |
2268 return |
2268 return |
2269 |
2269 |
2288 |
2288 |
2289 def hgRollback(self): |
2289 def hgRollback(self): |
2290 """ |
2290 """ |
2291 Public method used to rollback the last transaction. |
2291 Public method used to rollback the last transaction. |
2292 """ |
2292 """ |
2293 res = E5MessageBox.yesNo( |
2293 res = EricMessageBox.yesNo( |
2294 None, |
2294 None, |
2295 self.tr("Rollback last transaction"), |
2295 self.tr("Rollback last transaction"), |
2296 self.tr("""Are you sure you want to rollback the last""" |
2296 self.tr("""Are you sure you want to rollback the last""" |
2297 """ transaction?"""), |
2297 """ transaction?"""), |
2298 icon=E5MessageBox.Warning) |
2298 icon=EricMessageBox.Warning) |
2299 if res: |
2299 if res: |
2300 dia = HgDialog(self.tr('Rollback last transaction'), self) |
2300 dia = HgDialog(self.tr('Rollback last transaction'), self) |
2301 res = dia.startProcess(["rollback"]) |
2301 res = dia.startProcess(["rollback"]) |
2302 if res: |
2302 if res: |
2303 dia.exec() |
2303 dia.exec() |
2575 """ |
2575 """ |
2576 Public method to delete all backup bundles in the backup area. |
2576 Public method to delete all backup bundles in the backup area. |
2577 """ |
2577 """ |
2578 backupdir = os.path.join(self.getClient().getRepository(), |
2578 backupdir = os.path.join(self.getClient().getRepository(), |
2579 self.adminDir, "strip-backup") |
2579 self.adminDir, "strip-backup") |
2580 yes = E5MessageBox.yesNo( |
2580 yes = EricMessageBox.yesNo( |
2581 self.__ui, |
2581 self.__ui, |
2582 self.tr("Delete All Backups"), |
2582 self.tr("Delete All Backups"), |
2583 self.tr("""<p>Do you really want to delete all backup bundles""" |
2583 self.tr("""<p>Do you really want to delete all backup bundles""" |
2584 """ stored the backup area <b>{0}</b>?</p>""").format( |
2584 """ stored the backup area <b>{0}</b>?</p>""").format( |
2585 backupdir)) |
2585 backupdir)) |
2631 needsAdd = False |
2631 needsAdd = False |
2632 try: |
2632 try: |
2633 with open(hgsub, "r") as f: |
2633 with open(hgsub, "r") as f: |
2634 contents = f.readlines() |
2634 contents = f.readlines() |
2635 except OSError as err: |
2635 except OSError as err: |
2636 E5MessageBox.critical( |
2636 EricMessageBox.critical( |
2637 self.__ui, |
2637 self.__ui, |
2638 self.tr("Add Sub-repository"), |
2638 self.tr("Add Sub-repository"), |
2639 self.tr( |
2639 self.tr( |
2640 """<p>The sub-repositories file .hgsub could not""" |
2640 """<p>The sub-repositories file .hgsub could not""" |
2641 """ be read.</p><p>Reason: {0}</p>""") |
2641 """ be read.</p><p>Reason: {0}</p>""") |
2642 .format(str(err))) |
2642 .format(str(err))) |
2643 return |
2643 return |
2644 |
2644 |
2645 if entry in contents: |
2645 if entry in contents: |
2646 E5MessageBox.critical( |
2646 EricMessageBox.critical( |
2647 self.__ui, |
2647 self.__ui, |
2648 self.tr("Add Sub-repository"), |
2648 self.tr("Add Sub-repository"), |
2649 self.tr( |
2649 self.tr( |
2650 """<p>The sub-repositories file .hgsub already""" |
2650 """<p>The sub-repositories file .hgsub already""" |
2651 """ contains an entry <b>{0}</b>.""" |
2651 """ contains an entry <b>{0}</b>.""" |
2659 contents.append(entry) |
2659 contents.append(entry) |
2660 try: |
2660 try: |
2661 with open(hgsub, "w") as f: |
2661 with open(hgsub, "w") as f: |
2662 f.writelines(contents) |
2662 f.writelines(contents) |
2663 except OSError as err: |
2663 except OSError as err: |
2664 E5MessageBox.critical( |
2664 EricMessageBox.critical( |
2665 self.__ui, |
2665 self.__ui, |
2666 self.tr("Add Sub-repository"), |
2666 self.tr("Add Sub-repository"), |
2667 self.tr( |
2667 self.tr( |
2668 """<p>The sub-repositories file .hgsub could not""" |
2668 """<p>The sub-repositories file .hgsub could not""" |
2669 """ be written to.</p><p>Reason: {0}</p>""") |
2669 """ be written to.</p><p>Reason: {0}</p>""") |
2680 """ |
2680 """ |
2681 hgsub = self.getHgSubPath() |
2681 hgsub = self.getHgSubPath() |
2682 |
2682 |
2683 subrepositories = [] |
2683 subrepositories = [] |
2684 if not os.path.isfile(hgsub): |
2684 if not os.path.isfile(hgsub): |
2685 E5MessageBox.critical( |
2685 EricMessageBox.critical( |
2686 self.__ui, |
2686 self.__ui, |
2687 self.tr("Remove Sub-repositories"), |
2687 self.tr("Remove Sub-repositories"), |
2688 self.tr("""<p>The sub-repositories file .hgsub does not""" |
2688 self.tr("""<p>The sub-repositories file .hgsub does not""" |
2689 """ exist. Aborting...</p>""")) |
2689 """ exist. Aborting...</p>""")) |
2690 return |
2690 return |
2691 |
2691 |
2692 try: |
2692 try: |
2693 with open(hgsub, "r") as f: |
2693 with open(hgsub, "r") as f: |
2694 subrepositories = [line.strip() for line in f.readlines()] |
2694 subrepositories = [line.strip() for line in f.readlines()] |
2695 except OSError as err: |
2695 except OSError as err: |
2696 E5MessageBox.critical( |
2696 EricMessageBox.critical( |
2697 self.__ui, |
2697 self.__ui, |
2698 self.tr("Remove Sub-repositories"), |
2698 self.tr("Remove Sub-repositories"), |
2699 self.tr("""<p>The sub-repositories file .hgsub could not""" |
2699 self.tr("""<p>The sub-repositories file .hgsub could not""" |
2700 """ be read.</p><p>Reason: {0}</p>""") |
2700 """ be read.</p><p>Reason: {0}</p>""") |
2701 .format(str(err))) |
2701 .format(str(err))) |
2710 contents = "\n".join(subrepositories) + "\n" |
2710 contents = "\n".join(subrepositories) + "\n" |
2711 try: |
2711 try: |
2712 with open(hgsub, "w") as f: |
2712 with open(hgsub, "w") as f: |
2713 f.write(contents) |
2713 f.write(contents) |
2714 except OSError as err: |
2714 except OSError as err: |
2715 E5MessageBox.critical( |
2715 EricMessageBox.critical( |
2716 self.__ui, |
2716 self.__ui, |
2717 self.tr("Remove Sub-repositories"), |
2717 self.tr("Remove Sub-repositories"), |
2718 self.tr( |
2718 self.tr( |
2719 """<p>The sub-repositories file .hgsub could not""" |
2719 """<p>The sub-repositories file .hgsub could not""" |
2720 """ be written to.</p><p>Reason: {0}</p>""") |
2720 """ be written to.</p><p>Reason: {0}</p>""") |
2795 @param path name of the changed file (string) |
2795 @param path name of the changed file (string) |
2796 """ |
2796 """ |
2797 if self.__client: |
2797 if self.__client: |
2798 ok, err = self.__client.restartServer() |
2798 ok, err = self.__client.restartServer() |
2799 if not ok: |
2799 if not ok: |
2800 E5MessageBox.warning( |
2800 EricMessageBox.warning( |
2801 None, |
2801 None, |
2802 self.tr("Mercurial Command Server"), |
2802 self.tr("Mercurial Command Server"), |
2803 self.tr( |
2803 self.tr( |
2804 """<p>The Mercurial Command Server could not be""" |
2804 """<p>The Mercurial Command Server could not be""" |
2805 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
2805 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
2933 self.stopClient() |
2933 self.stopClient() |
2934 |
2934 |
2935 self.__client = HgClient(repodir, "utf-8", self) |
2935 self.__client = HgClient(repodir, "utf-8", self) |
2936 ok, err = self.__client.startServer() |
2936 ok, err = self.__client.startServer() |
2937 if not ok: |
2937 if not ok: |
2938 E5MessageBox.warning( |
2938 EricMessageBox.warning( |
2939 None, |
2939 None, |
2940 self.tr("Mercurial Command Server"), |
2940 self.tr("Mercurial Command Server"), |
2941 self.tr( |
2941 self.tr( |
2942 """<p>The Mercurial Command Server could not be""" |
2942 """<p>The Mercurial Command Server could not be""" |
2943 """ started.</p><p>Reason: {0}</p>""").format(err)) |
2943 """ started.</p><p>Reason: {0}</p>""").format(err)) |