22 |
22 |
23 class SvnUrlSelectionDialog(QDialog, Ui_SvnUrlSelectionDialog): |
23 class SvnUrlSelectionDialog(QDialog, Ui_SvnUrlSelectionDialog): |
24 """ |
24 """ |
25 Class implementing a dialog to enter the URLs for the svn diff command. |
25 Class implementing a dialog to enter the URLs for the svn diff command. |
26 """ |
26 """ |
|
27 |
27 def __init__(self, vcs, tagsList, branchesList, path, parent=None): |
28 def __init__(self, vcs, tagsList, branchesList, path, parent=None): |
28 """ |
29 """ |
29 Constructor |
30 Constructor |
30 |
31 |
31 @param vcs reference to the vcs object |
32 @param vcs reference to the vcs object |
32 @param tagsList list of tags (list of strings) |
33 @param tagsList list of tags (list of strings) |
33 @param branchesList list of branches (list of strings) |
34 @param branchesList list of branches (list of strings) |
34 @param path pathname to determine the repository URL from (string) |
35 @param path pathname to determine the repository URL from (string) |
35 @param parent parent widget of the dialog (QWidget) |
36 @param parent parent widget of the dialog (QWidget) |
36 """ |
37 """ |
37 super().__init__(parent) |
38 super().__init__(parent) |
38 self.setupUi(self) |
39 self.setupUi(self) |
39 |
40 |
40 if vcs.version < (1, 4, 0): |
41 if vcs.version < (1, 4, 0): |
41 self.summaryCheckBox.setEnabled(False) |
42 self.summaryCheckBox.setEnabled(False) |
42 self.summaryCheckBox.setChecked(False) |
43 self.summaryCheckBox.setChecked(False) |
43 |
44 |
44 self.vcs = vcs |
45 self.vcs = vcs |
45 self.tagsList = tagsList |
46 self.tagsList = tagsList |
46 self.branchesList = branchesList |
47 self.branchesList = branchesList |
47 |
48 |
48 self.typeCombo1.addItems(["trunk/", "tags/", "branches/"]) |
49 self.typeCombo1.addItems(["trunk/", "tags/", "branches/"]) |
49 self.typeCombo2.addItems(["trunk/", "tags/", "branches/"]) |
50 self.typeCombo2.addItems(["trunk/", "tags/", "branches/"]) |
50 |
51 |
51 reposURL = self.vcs.svnGetReposName(path) |
52 reposURL = self.vcs.svnGetReposName(path) |
52 if reposURL is None: |
53 if reposURL is None: |
53 EricMessageBox.critical( |
54 EricMessageBox.critical( |
54 self, |
55 self, |
55 self.tr("Subversion Error"), |
56 self.tr("Subversion Error"), |
56 self.tr( |
57 self.tr( |
57 """The URL of the project repository could not be""" |
58 """The URL of the project repository could not be""" |
58 """ retrieved from the working copy. The operation will""" |
59 """ retrieved from the working copy. The operation will""" |
59 """ be aborted""")) |
60 """ be aborted""" |
|
61 ), |
|
62 ) |
60 self.reject() |
63 self.reject() |
61 return |
64 return |
62 |
65 |
63 if self.vcs.otherData["standardLayout"]: |
66 if self.vcs.otherData["standardLayout"]: |
64 # determine the base path of the project in the repository |
67 # determine the base path of the project in the repository |
65 rx_base = re.compile('(.+/)(trunk|tags|branches).*') |
68 rx_base = re.compile("(.+/)(trunk|tags|branches).*") |
66 match = rx_base.fullmatch(reposURL) |
69 match = rx_base.fullmatch(reposURL) |
67 if match is None: |
70 if match is None: |
68 EricMessageBox.critical( |
71 EricMessageBox.critical( |
69 self, |
72 self, |
70 self.tr("Subversion Error"), |
73 self.tr("Subversion Error"), |
71 self.tr( |
74 self.tr( |
72 """The URL of the project repository has an""" |
75 """The URL of the project repository has an""" |
73 """ invalid format. The list operation will""" |
76 """ invalid format. The list operation will""" |
74 """ be aborted""")) |
77 """ be aborted""" |
|
78 ), |
|
79 ) |
75 self.reject() |
80 self.reject() |
76 return |
81 return |
77 |
82 |
78 reposRoot = match.group(1) |
83 reposRoot = match.group(1) |
79 self.repoRootLabel1.setText(reposRoot) |
84 self.repoRootLabel1.setText(reposRoot) |
80 self.repoRootLabel2.setText(reposRoot) |
85 self.repoRootLabel2.setText(reposRoot) |
81 else: |
86 else: |
82 project = ericApp().getObject('Project') |
87 project = ericApp().getObject("Project") |
83 if ( |
88 if Utilities.normcasepath(path) != Utilities.normcasepath( |
84 Utilities.normcasepath(path) != |
89 project.getProjectPath() |
85 Utilities.normcasepath(project.getProjectPath()) |
|
86 ): |
90 ): |
87 path = project.getRelativePath(path) |
91 path = project.getRelativePath(path) |
88 reposURL = reposURL.replace(path, '') |
92 reposURL = reposURL.replace(path, "") |
89 self.repoRootLabel1.hide() |
93 self.repoRootLabel1.hide() |
90 self.typeCombo1.hide() |
94 self.typeCombo1.hide() |
91 self.labelCombo1.addItems([reposURL] + sorted(self.vcs.tagsList)) |
95 self.labelCombo1.addItems([reposURL] + sorted(self.vcs.tagsList)) |
92 self.labelCombo1.setEnabled(True) |
96 self.labelCombo1.setEnabled(True) |
93 self.repoRootLabel2.hide() |
97 self.repoRootLabel2.hide() |
94 self.typeCombo2.hide() |
98 self.typeCombo2.hide() |
95 self.labelCombo2.addItems([reposURL] + sorted(self.vcs.tagsList)) |
99 self.labelCombo2.addItems([reposURL] + sorted(self.vcs.tagsList)) |
96 self.labelCombo2.setEnabled(True) |
100 self.labelCombo2.setEnabled(True) |
97 |
101 |
98 msh = self.minimumSizeHint() |
102 msh = self.minimumSizeHint() |
99 self.resize(max(self.width(), msh.width()), msh.height()) |
103 self.resize(max(self.width(), msh.width()), msh.height()) |
100 |
104 |
101 def __changeLabelCombo(self, labelCombo, type_): |
105 def __changeLabelCombo(self, labelCombo, type_): |
102 """ |
106 """ |
103 Private method used to change the label combo depending on the |
107 Private method used to change the label combo depending on the |
104 selected type. |
108 selected type. |
105 |
109 |
106 @param labelCombo reference to the labelCombo object (QComboBox) |
110 @param labelCombo reference to the labelCombo object (QComboBox) |
107 @param type_ type string (string) |
111 @param type_ type string (string) |
108 """ |
112 """ |
109 if type_ == "trunk/": |
113 if type_ == "trunk/": |
110 labelCombo.clear() |
114 labelCombo.clear() |
118 elif type_ == "branches/": |
122 elif type_ == "branches/": |
119 labelCombo.clear() |
123 labelCombo.clear() |
120 labelCombo.clearEditText() |
124 labelCombo.clearEditText() |
121 labelCombo.addItems(sorted(self.branchesList)) |
125 labelCombo.addItems(sorted(self.branchesList)) |
122 labelCombo.setEnabled(True) |
126 labelCombo.setEnabled(True) |
123 |
127 |
124 @pyqtSlot(int) |
128 @pyqtSlot(int) |
125 def on_typeCombo1_currentIndexChanged(self, index): |
129 def on_typeCombo1_currentIndexChanged(self, index): |
126 """ |
130 """ |
127 Private slot called when the selected type was changed. |
131 Private slot called when the selected type was changed. |
128 |
132 |
129 @param index index of the current item |
133 @param index index of the current item |
130 @type int |
134 @type int |
131 """ |
135 """ |
132 type_ = self.typeCombo1.itemText(index) |
136 type_ = self.typeCombo1.itemText(index) |
133 self.__changeLabelCombo(self.labelCombo1, type_) |
137 self.__changeLabelCombo(self.labelCombo1, type_) |
134 |
138 |
135 @pyqtSlot(int) |
139 @pyqtSlot(int) |
136 def on_typeCombo2_currentIndexChanged(self, index): |
140 def on_typeCombo2_currentIndexChanged(self, index): |
137 """ |
141 """ |
138 Private slot called when the selected type was changed. |
142 Private slot called when the selected type was changed. |
139 |
143 |
140 @param index index of the current item |
144 @param index index of the current item |
141 @type int |
145 @type int |
142 """ |
146 """ |
143 type_ = self.typeCombo2.itemText(index) |
147 type_ = self.typeCombo2.itemText(index) |
144 self.__changeLabelCombo(self.labelCombo2, type_) |
148 self.__changeLabelCombo(self.labelCombo2, type_) |
145 |
149 |
146 def getURLs(self): |
150 def getURLs(self): |
147 """ |
151 """ |
148 Public method to get the entered URLs. |
152 Public method to get the entered URLs. |
149 |
153 |
150 @return tuple of list of two URL strings (list of strings) and |
154 @return tuple of list of two URL strings (list of strings) and |
151 a flag indicating a diff summary (boolean) |
155 a flag indicating a diff summary (boolean) |
152 """ |
156 """ |
153 if self.vcs.otherData["standardLayout"]: |
157 if self.vcs.otherData["standardLayout"]: |
154 url1 = ( |
158 url1 = ( |
155 self.repoRootLabel1.text() + |
159 self.repoRootLabel1.text() |
156 self.typeCombo1.currentText() + |
160 + self.typeCombo1.currentText() |
157 self.labelCombo1.currentText() |
161 + self.labelCombo1.currentText() |
158 ) |
162 ) |
159 url2 = ( |
163 url2 = ( |
160 self.repoRootLabel2.text() + |
164 self.repoRootLabel2.text() |
161 self.typeCombo2.currentText() + |
165 + self.typeCombo2.currentText() |
162 self.labelCombo2.currentText() |
166 + self.labelCombo2.currentText() |
163 ) |
167 ) |
164 else: |
168 else: |
165 url1 = self.labelCombo1.currentText() |
169 url1 = self.labelCombo1.currentText() |
166 url2 = self.labelCombo2.currentText() |
170 url2 = self.labelCombo2.currentText() |
167 |
171 |
168 return [url1, url2], self.summaryCheckBox.isChecked() |
172 return [url1, url2], self.summaryCheckBox.isChecked() |