eric6/VCS/ProjectHelper.py

Sun, 01 Sep 2019 19:40:53 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 01 Sep 2019 19:40:53 +0200
branch
without_py2_and_pyqt4
changeset 7198
684261ef2165
parent 6942
2602857055c5
child 7229
53054eb5b15a
permissions
-rw-r--r--

Removed the Qt4 runtime stuff.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6558
diff changeset
3 # Copyright (c) 2005 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the base class of the VCS project helper.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
11
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import shutil
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import copy
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
16 from PyQt5.QtCore import pyqtSlot, QDir, QFileInfo, QObject, QCoreApplication
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
17 from PyQt5.QtWidgets import QDialog, QInputDialog, QToolBar
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
19 from E5Gui.E5Action import E5Action
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 486
diff changeset
20 from E5Gui import E5MessageBox
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 536
diff changeset
21 from E5Gui.E5Application import e5App
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 import Preferences
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
24 import UI.PixmapCache
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
25 import UI.Config
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
27
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 class VcsProjectHelper(QObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Class implementing the base class of the VCS project helper.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
32 def __init__(self, vcsObject, projectObject, parent=None, name=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param vcsObject reference to the vcs object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param projectObject reference to the project object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param parent parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @param name name of this object (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
41 super(VcsProjectHelper, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 if name:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.setObjectName(name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.vcs = vcsObject
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.project = projectObject
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.actions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
1881
bab54b00f79a Fixed an issue introduced by the VCS changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
50 self.vcsAddAct = None
bab54b00f79a Fixed an issue introduced by the VCS changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
51
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.initActions()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 def setObjects(self, vcsObject, projectObject):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 Public method to set references to the vcs and project objects.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 @param vcsObject reference to the vcs object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 @param projectObject reference to the project object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.vcs = vcsObject
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.project = projectObject
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def initActions(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Public method to generate the action objects.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
3031
ed2eaa573ca5 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
68 self.vcsNewAct = E5Action(
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
69 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
70 "VcsProjectHelper", 'New from repository'),
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
71 UI.PixmapCache.getIcon("vcsCheckout.png"),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
72 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
73 "VcsProjectHelper", '&New from repository...'),
3031
ed2eaa573ca5 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
74 0, 0, self, 'vcs_new')
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
75 self.vcsNewAct.setStatusTip(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
76 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 'Create a new project from the VCS repository'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 ))
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
79 self.vcsNewAct.setWhatsThis(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
80 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 """<b>New from repository</b>"""
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
82 """<p>This creates a new local project from the VCS"""
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
83 """ repository.</p>"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
85 self.vcsNewAct.triggered.connect(self._vcsCheckout)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.actions.append(self.vcsNewAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
88 self.vcsExportAct = E5Action(
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
89 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
90 "VcsProjectHelper", 'Export from repository'),
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
91 UI.PixmapCache.getIcon("vcsExport.png"),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
92 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
93 "VcsProjectHelper", '&Export from repository...'),
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
94 0, 0, self, 'vcs_export')
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
95 self.vcsExportAct.setStatusTip(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
96 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 'Export a project from the repository'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 ))
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
99 self.vcsExportAct.setWhatsThis(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
100 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """<b>Export from repository</b>"""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """<p>This exports a project from the repository.</p>"""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
104 self.vcsExportAct.triggered.connect(self._vcsExport)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.actions.append(self.vcsExportAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
3031
ed2eaa573ca5 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
107 self.vcsAddAct = E5Action(
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
108 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
109 "VcsProjectHelper", 'Add to repository'),
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
110 UI.PixmapCache.getIcon("vcsCommit.png"),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
111 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
112 "VcsProjectHelper", '&Add to repository...'),
3031
ed2eaa573ca5 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
113 0, 0, self, 'vcs_add')
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
114 self.vcsAddAct.setStatusTip(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
115 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 'Add the local project to the VCS repository'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 ))
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
118 self.vcsAddAct.setWhatsThis(QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
119 "VcsProjectHelper",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """<b>Add to repository</b>"""
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
121 """<p>This adds (imports) the local project to the VCS"""
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
122 """ repository.</p>"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
124 self.vcsAddAct.triggered.connect(self._vcsImport)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.actions.append(self.vcsAddAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 def initMenu(self, menu):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 Public method to generate the VCS menu.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 @param menu reference to the menu to be populated (QMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 menu.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 menu.addAction(self.vcsNewAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 menu.addAction(self.vcsExportAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 menu.addSeparator()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 menu.addAction(self.vcsAddAct)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 menu.addSeparator()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
141 def initToolbar(self, ui, toolbarManager):
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
142 """
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
143 Public slot to initialize the VCS toolbar.
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
144
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
145 @param ui reference to the main window (UserInterface)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
146 @param toolbarManager reference to a toolbar manager object
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
147 (E5ToolBarManager)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
148 @return the toolbar generated (QToolBar)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
149 """
6891
93f82da09f22 Fixed some code style issues detected by the new 'return' checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
150 return None # __IGNORE_WARNING_M831__
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
151
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
152 def initBasicToolbar(self, ui, toolbarManager):
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
153 """
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
154 Public slot to initialize the basic VCS toolbar.
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
155
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
156 @param ui reference to the main window (UserInterface)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
157 @param toolbarManager reference to a toolbar manager object
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
158 (E5ToolBarManager)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
159 @return the toolbar generated (QToolBar)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
160 """
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
161 tb = QToolBar(QCoreApplication.translate("VcsProjectHelper", "VCS"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
162 ui)
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
163 tb.setIconSize(UI.Config.ToolBarIconSize)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
164 tb.setObjectName("VersionControlToolbar")
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
165 tb.setToolTip(QCoreApplication.translate("VcsProjectHelper", 'VCS'))
4079
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
166
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
167 tb.addAction(self.vcsNewAct)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
168 tb.addAction(self.vcsExportAct)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
169 tb.addSeparator()
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
170 tb.addAction(self.vcsAddAct)
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
171
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
172 toolbarManager.addToolBar(tb, tb.windowTitle())
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
173
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
174 return tb
a3319822d303 Added possibility for plug-ins to have toolbars.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
175
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 def showMenu(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 Public slot called before the vcs menu is shown.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
1881
bab54b00f79a Fixed an issue introduced by the VCS changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
180 if self.vcsAddAct:
6556
8aa72eaa2d70 VCS.ProjectHelper: fixed a strange issue caused by self.project being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6489
diff changeset
181 self.vcsAddAct.setEnabled(self.project and self.project.isOpen())
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
182
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
183 @pyqtSlot()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
184 def _vcsCheckout(self, export=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 Protected slot used to create a local project from the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 @param export flag indicating whether an export or a checkout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 should be performed
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 """
6556
8aa72eaa2d70 VCS.ProjectHelper: fixed a strange issue caused by self.project being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6489
diff changeset
191 if not self.project or not self.project.checkDirty():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
194 vcsSystemsDict = e5App().getObject("PluginManager")\
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 .getPluginDisplayStrings("version_control")
1012
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
196 if not vcsSystemsDict:
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
197 # no version control system found
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
198 return
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
199
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 vcsSystemsDisplay = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 keys = sorted(vcsSystemsDict.keys())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 for key in keys:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 vcsSystemsDisplay.append(vcsSystemsDict[key])
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 543
diff changeset
204 vcsSelected, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 None,
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
206 QCoreApplication.translate("VcsProjectHelper", "New Project"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
207 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
208 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
209 "Select version control system for the project"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 vcsSystemsDisplay,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 if not ok:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 return
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
214
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
215 selectedVcsSystem = None
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
216 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 if vcsSystemDisplay == vcsSelected:
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
218 selectedVcsSystem = vcsSystem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220
1941
aedf18497117 Fixed an issue creating a new project via the VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1881
diff changeset
221 if not self.project.closeProject():
aedf18497117 Fixed an issue creating a new project via the VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1881
diff changeset
222 return
aedf18497117 Fixed an issue creating a new project via the VCS.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1881
diff changeset
223
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
224 vcs = self.project.initVCS(selectedVcsSystem)
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
225 if vcs is not None:
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
226 vcsdlg = vcs.vcsNewProjectOptionsDialog()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 if vcsdlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 projectdir, vcsDataDict = vcsdlg.getData()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 # edit VCS command options
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
230 if vcs.vcsSupportCommandOptions():
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
231 vcores = E5MessageBox.yesNo(
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
232 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
233 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
234 "VcsProjectHelper", "New Project"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
235 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
236 "VcsProjectHelper",
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
237 """Would you like to edit the VCS command"""
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
238 """ options?"""))
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
239 else:
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
240 vcores = False
543
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
241 if vcores:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3031
diff changeset
242 from .CommandOptionsDialog import VcsCommandOptionsDialog
6489
577c644ab6f3 VCS.ProjectHelper: fixed an issue using the wrong variable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
243 codlg = VcsCommandOptionsDialog(vcs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 if codlg.exec_() == QDialog.Accepted:
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
245 vcs.vcsSetOptions(codlg.getOptions())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 # create the project directory if it doesn't exist already
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 if not os.path.isdir(projectdir):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 os.makedirs(projectdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 except EnvironmentError:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
252 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
253 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
254 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
255 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
256 "Create project directory"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
257 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
258 "VcsProjectHelper",
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
259 "<p>The project directory <b>{0}</b> could not"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 " be created.</p>").format(projectdir))
6558
db48660ca7c0 VCS.ProjectHelper, Project.Project: fix the handling when a VCS clone or export operation fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6556
diff changeset
261 self.project.resetVCS()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 # create the project from the VCS
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
265 vcs.vcsSetDataFromDict(vcsDataDict)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 if export:
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
267 ok = vcs.vcsExport(vcsDataDict, projectdir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 else:
6168
e9d3ea144b0b Fixed a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6158
diff changeset
269 ok = vcs.vcsCheckout(vcsDataDict, projectdir, False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 if ok:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 projectdir = os.path.normpath(projectdir)
608
d8fea1e76975 Removed capability to write compressed project (and related) files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
272 filters = ["*.e4p"]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 d = QDir(projectdir)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 plist = d.entryInfoList(filters)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 if len(plist):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 if len(plist) == 1:
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
277 self.project.openProject(
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
278 plist[0].absoluteFilePath())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 pfilenamelist = d.entryList(filters)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 pfilename, ok = QInputDialog.getItem(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 None,
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
283 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
284 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
285 "New project from repository"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
286 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
287 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
288 "Select a project file to open."),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 pfilenamelist, 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 if ok:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 543
diff changeset
291 self.project.openProject(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 QFileInfo(d, pfilename).absoluteFilePath())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 if export:
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
294 self.project.pdata["VCS"] = 'None'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.project.vcs = self.project.initVCS()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 self.project.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 self.project.saveProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
299 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
300 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
301 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
302 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
303 "New project from repository"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
304 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
305 "VcsProjectHelper",
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
306 "The project retrieved from the repository"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 " does not contain an eric project file"
608
d8fea1e76975 Removed capability to write compressed project (and related) files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
308 " (*.e4p). Create it?"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
309 yesDefault=True)
543
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
310 if res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 self.project.ppath = projectdir
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 self.project.opened = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
314 from Project.PropertiesDialog import \
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
315 PropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 dlg = PropertiesDialog(self.project, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 if dlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 dlg.storeData()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.project.initFileTypes()
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
320 self.project.pdata["VCS"] = selectedVcsSystem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 self.project.setDirty(True)
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
322 if self.project.pdata["MAINSCRIPT"]:
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
323 ms = os.path.join(
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
324 self.project.ppath,
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
325 self.project.pdata["MAINSCRIPT"])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 if os.path.exists(ms):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 self.project.appendFile(ms)
6158
9765e0c375d0 Fixed an issue causing eric to crash when creating a new project from a repository (i.e. cloning or exporting).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
328 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 ms = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 self.project.newProjectAddFiles(ms)
3164
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
331 self.project.createProjectManagementDir()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.project.saveProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 self.project.openProject(self.project.pfile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 if not export:
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
335 res = E5MessageBox.yesNo(
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
336 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
337 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
338 "VcsProjectHelper",
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
339 "New project from repository"),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
340 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
341 "VcsProjectHelper",
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
342 "Shall the project file be added"
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
343 " to the repository?"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
344 yesDefault=True)
543
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
345 if res:
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
346 self.project.vcs.vcsAdd(
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
347 self.project.pfile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 else:
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
349 E5MessageBox.critical(
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
350 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
351 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
352 "VcsProjectHelper", "New project from repository"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
353 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
354 "VcsProjectHelper",
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
355 """The project could not be retrieved from"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 """ the repository."""))
6558
db48660ca7c0 VCS.ProjectHelper, Project.Project: fix the handling when a VCS clone or export operation fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6556
diff changeset
357 self.project.resetVCS()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 def _vcsExport(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 Protected slot used to export a project from the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 self._vcsCheckout(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 def _vcsImport(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 Protected slot used to import the local project into the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
369 <b>NOTE</b>:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 This does not necessarily make the local project a vcs controlled
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
371 project. You may have to checkout the project from the repository
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
372 in order to accomplish that.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 def revertChanges():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 Local function to revert the changes made to the project object.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
378 self.project.pdata["VCS"] = pdata_vcs
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 self.project.pdata["VCSOPTIONS"] = copy.deepcopy(pdata_vcsoptions)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 self.project.pdata["VCSOTHERDATA"] = copy.deepcopy(pdata_vcsother)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 self.project.vcs = vcs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 self.project.vcsProjectHelper = vcsHelper
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 self.project.vcsBasicHelper = vcs is None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 self.initMenu(self.project.vcsMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 self.project.setDirty(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 self.project.saveProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387
5099
175b36822cc9 Continued cleaning up some code related to the Project class and data structures.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
388 pdata_vcs = self.project.pdata["VCS"]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 pdata_vcsoptions = copy.deepcopy(self.project.pdata["VCSOPTIONS"])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 pdata_vcsother = copy.deepcopy(self.project.pdata["VCSOTHERDATA"])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 vcs = self.project.vcs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 vcsHelper = self.project.vcsProjectHelper
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
393 vcsSystemsDict = e5App().getObject("PluginManager")\
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 .getPluginDisplayStrings("version_control")
1012
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
395 if not vcsSystemsDict:
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
396 # no version control system found
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
397 return
e3c069f40a4a Fixed an issue in the generic VCS project helper.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
398
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 vcsSystemsDisplay = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
400 keys = sorted(list(vcsSystemsDict.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 for key in keys:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 vcsSystemsDisplay.append(vcsSystemsDict[key])
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 543
diff changeset
403 vcsSelected, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 None,
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
405 QCoreApplication.translate("VcsProjectHelper", "Import Project"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
406 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
407 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
408 "Select version control system for the project"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 vcsSystemsDisplay,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 if not ok:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 return
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
413
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
414 selectedVcsSystem = None
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
415 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 if vcsSystemDisplay == vcsSelected:
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
417 selectedVcsSystem = vcsSystem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
420 if selectedVcsSystem is not None:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
421 self.project.pdata["VCS"] = selectedVcsSystem
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
422 self.project.vcs = self.project.initVCS(selectedVcsSystem)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
423 if self.project.vcs is not None:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
424 vcsdlg = self.project.vcs.vcsOptionsDialog(
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
425 self.project, self.project.name, 1)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
426 if vcsdlg.exec_() == QDialog.Accepted:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
427 vcsDataDict = vcsdlg.getData()
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
428 # edit VCS command options
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
429 if self.project.vcs.vcsSupportCommandOptions():
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
430 vcores = E5MessageBox.yesNo(
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
431 self.parent(),
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
432 QCoreApplication.translate(
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
433 "VcsProjectHelper", "Import Project"),
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
434 QCoreApplication.translate(
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
435 "VcsProjectHelper",
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
436 """Would you like to edit the VCS command"""
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
437 """ options?"""))
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
438 else:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
439 vcores = False
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
440 if vcores:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
441 from .CommandOptionsDialog import \
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
442 VcsCommandOptionsDialog
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
443 codlg = VcsCommandOptionsDialog(self.project.vcs)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
444 if codlg.exec_() == QDialog.Accepted:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
445 self.project.vcs.vcsSetOptions(codlg.getOptions())
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
446 self.project.setDirty(True)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
447 self.project.vcs.vcsSetDataFromDict(vcsDataDict)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
448 self.project.saveProject()
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
449 isVcsControlled = self.project.vcs.vcsImport(
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
450 vcsDataDict, self.project.ppath)[0]
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
451 if isVcsControlled:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
452 # reopen the project
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
453 self.project.openProject(self.project.pfile)
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
454 else:
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
455 # revert the changes to the local project
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
456 # because the project dir is not a VCS directory
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
457 revertChanges()
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
458 else:
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6168
diff changeset
459 # revert the changes because user cancelled
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 revertChanges()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 def _vcsUpdate(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 Protected slot used to update the local project from the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 shouldReopen = self.vcs.vcsUpdate(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 if shouldReopen:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
468 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
469 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
470 QCoreApplication.translate("VcsProjectHelper", "Update"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
471 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
472 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
473 """The project should be reread. Do this now?"""),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
474 yesDefault=True)
543
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
475 if res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 self.project.reopenProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 def _vcsCommit(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 """
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
480 Protected slot used to commit changes to the local project to the
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
481 repository.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if Preferences.getVCS("AutoSaveProject"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 self.project.saveProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 if Preferences.getVCS("AutoSaveFiles"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 self.project.saveAllScripts()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 self.vcs.vcsCommit(self.project.ppath, '')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 def _vcsRemove(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 Protected slot used to remove the local project from the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 Depending on the parameters set in the vcs object the project
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 may be removed from the local disk as well.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 """
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
496 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
497 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
498 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
499 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
500 "Remove project from repository"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
501 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
502 "VcsProjectHelper",
3031
ed2eaa573ca5 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
503 "Dou you really want to remove this project from"
543
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
504 " the repository (and disk)?"))
a558e3cb7b5a Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
505 if res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 self.vcs.vcsRemove(self.project.ppath, True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 self._vcsCommit()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 if not os.path.exists(self.project.pfile):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 ppath = self.project.ppath
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 self.setDirty(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 self.project.closeProject()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 shutil.rmtree(ppath, True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def _vcsCommandOptions(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 Protected slot to edit the VCS command options.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 """
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
518 if self.vcs.vcsSupportCommandOptions():
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
519 from .CommandOptionsDialog import VcsCommandOptionsDialog
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
520 codlg = VcsCommandOptionsDialog(self.vcs)
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
521 if codlg.exec_() == QDialog.Accepted:
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
522 self.vcs.vcsSetOptions(codlg.getOptions())
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
523 self.project.setDirty(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 def _vcsLog(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 Protected slot used to show the log of the local project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 """
5452
9f89364d9ffd Removed the VCS log dialogs in favour of the log browser dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
529 # kept for backward compatibility for plug-ins
9f89364d9ffd Removed the VCS log dialogs in favour of the log browser dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
530 self._vcsLogBrowser()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531
3349
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
532 def _vcsLogBrowser(self):
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
533 """
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
534 Protected slot used to show the log of the local project with a
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
535 log browser dialog.
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
536 """
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
537 self.vcs.vcsLogBrowser(self.project.ppath)
2a034a7f1f54 Made the status LED (right lower corner) clickable (depending on overall VCS status it will show the log browser or the status dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3345
diff changeset
538
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 def _vcsDiff(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 """
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
541 Protected slot used to show the difference of the local project to
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
542 the repository.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 self.vcs.vcsDiff(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 def _vcsStatus(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 Protected slot used to show the status of the local project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.vcs.vcsStatus(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 def _vcsTag(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 Protected slot used to tag the local project in the repository.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 self.vcs.vcsTag(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 def _vcsRevert(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 Protected slot used to revert changes made to the local project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 self.vcs.vcsRevert(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 def _vcsSwitch(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 Protected slot used to switch the local project to another tag/branch.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 """
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1012
diff changeset
568 shouldReopen = self.vcs.vcsSwitch(self.project.ppath)
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1012
diff changeset
569 if shouldReopen:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
570 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3013
diff changeset
571 self.parent(),
5669
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
572 QCoreApplication.translate("VcsProjectHelper", "Switch"),
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
573 QCoreApplication.translate(
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
574 "VcsProjectHelper",
63295be38bc6 Fixed a translations related issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5452
diff changeset
575 """The project should be reread. Do this now?"""),
1083
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1012
diff changeset
576 yesDefault=True)
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1012
diff changeset
577 if res:
dc680a0ce221 Extended the code logic for the switch command of the various version control interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1012
diff changeset
578 self.project.reopenProject()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 def _vcsMerge(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 """
3013
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
582 Protected slot used to merge changes of a tag/revision into the local
fe886b7f8f40 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
583 project.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 self.vcs.vcsMerge(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 def _vcsCleanup(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 Protected slot used to cleanup the local project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 self.vcs.vcsCleanup(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 def _vcsCommand(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 Protected slot used to execute an arbitrary vcs command.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 self.vcs.vcsCommandLine(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 def _vcsInfoDisplay(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 Protected slot called to show some vcs information.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
603 from .RepositoryInfoDialog import VcsRepositoryInfoDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 info = self.vcs.vcsRepositoryInfos(self.project.ppath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 dlg = VcsRepositoryInfoDialog(None, info)
608
d8fea1e76975 Removed capability to write compressed project (and related) files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
606 dlg.exec_()

eric ide

mercurial