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