58 self.__switchedColumn = 6 |
63 self.__switchedColumn = 6 |
59 self.__lockinfoColumn = 7 |
64 self.__lockinfoColumn = 7 |
60 self.__upToDateColumn = 8 |
65 self.__upToDateColumn = 8 |
61 self.__pathColumn = 12 |
66 self.__pathColumn = 12 |
62 self.__lastColumn = self.statusList.columnCount() |
67 self.__lastColumn = self.statusList.columnCount() |
63 |
68 |
64 self.refreshButton = self.buttonBox.addButton( |
69 self.refreshButton = self.buttonBox.addButton( |
65 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
70 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole |
66 self.refreshButton.setToolTip( |
71 ) |
67 self.tr("Press to refresh the status display")) |
72 self.refreshButton.setToolTip(self.tr("Press to refresh the status display")) |
68 self.refreshButton.setEnabled(False) |
73 self.refreshButton.setEnabled(False) |
69 self.buttonBox.button( |
74 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
70 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
75 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
71 self.buttonBox.button( |
76 |
72 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
|
73 |
|
74 self.diff = None |
77 self.diff = None |
75 self.vcs = vcs |
78 self.vcs = vcs |
76 self.vcs.committed.connect(self.__committed) |
79 self.vcs.committed.connect(self.__committed) |
77 |
80 |
78 self.statusList.headerItem().setText(self.__lastColumn, "") |
81 self.statusList.headerItem().setText(self.__lastColumn, "") |
79 self.statusList.header().setSortIndicator(self.__pathColumn, |
82 self.statusList.header().setSortIndicator( |
80 Qt.SortOrder.AscendingOrder) |
83 self.__pathColumn, Qt.SortOrder.AscendingOrder |
|
84 ) |
81 if pysvn.svn_version < (1, 5, 0) or pysvn.version < (1, 6, 0): |
85 if pysvn.svn_version < (1, 5, 0) or pysvn.version < (1, 6, 0): |
82 self.statusList.header().hideSection(self.__changelistColumn) |
86 self.statusList.header().hideSection(self.__changelistColumn) |
83 |
87 |
84 self.menuactions = [] |
88 self.menuactions = [] |
85 self.menu = QMenu() |
89 self.menu = QMenu() |
86 self.menuactions.append(self.menu.addAction( |
90 self.menuactions.append( |
87 self.tr("Commit changes to repository..."), self.__commit)) |
91 self.menu.addAction( |
88 self.menuactions.append(self.menu.addAction( |
92 self.tr("Commit changes to repository..."), self.__commit |
89 self.tr("Select all for commit"), self.__commitSelectAll)) |
93 ) |
90 self.menuactions.append(self.menu.addAction( |
94 ) |
91 self.tr("Deselect all from commit"), self.__commitDeselectAll)) |
95 self.menuactions.append( |
|
96 self.menu.addAction( |
|
97 self.tr("Select all for commit"), self.__commitSelectAll |
|
98 ) |
|
99 ) |
|
100 self.menuactions.append( |
|
101 self.menu.addAction( |
|
102 self.tr("Deselect all from commit"), self.__commitDeselectAll |
|
103 ) |
|
104 ) |
92 self.menu.addSeparator() |
105 self.menu.addSeparator() |
93 self.menuactions.append(self.menu.addAction( |
106 self.menuactions.append( |
94 self.tr("Add to repository"), self.__add)) |
107 self.menu.addAction(self.tr("Add to repository"), self.__add) |
95 self.menuactions.append(self.menu.addAction( |
108 ) |
96 self.tr("Show differences"), self.__diff)) |
109 self.menuactions.append( |
97 self.menuactions.append(self.menu.addAction( |
110 self.menu.addAction(self.tr("Show differences"), self.__diff) |
98 self.tr("Show differences side-by-side"), self.__sbsDiff)) |
111 ) |
99 self.menuactions.append(self.menu.addAction( |
112 self.menuactions.append( |
100 self.tr("Revert changes"), self.__revert)) |
113 self.menu.addAction( |
101 self.menuactions.append(self.menu.addAction( |
114 self.tr("Show differences side-by-side"), self.__sbsDiff |
102 self.tr("Restore Missing"), self.__restoreMissing)) |
115 ) |
|
116 ) |
|
117 self.menuactions.append( |
|
118 self.menu.addAction(self.tr("Revert changes"), self.__revert) |
|
119 ) |
|
120 self.menuactions.append( |
|
121 self.menu.addAction(self.tr("Restore Missing"), self.__restoreMissing) |
|
122 ) |
103 if pysvn.svn_version >= (1, 5, 0) and pysvn.version >= (1, 6, 0): |
123 if pysvn.svn_version >= (1, 5, 0) and pysvn.version >= (1, 6, 0): |
104 self.menu.addSeparator() |
124 self.menu.addSeparator() |
105 self.menuactions.append(self.menu.addAction( |
125 self.menuactions.append( |
106 self.tr("Add to Changelist"), self.__addToChangelist)) |
126 self.menu.addAction( |
107 self.menuactions.append(self.menu.addAction( |
127 self.tr("Add to Changelist"), self.__addToChangelist |
108 self.tr("Remove from Changelist"), |
128 ) |
109 self.__removeFromChangelist)) |
129 ) |
|
130 self.menuactions.append( |
|
131 self.menu.addAction( |
|
132 self.tr("Remove from Changelist"), self.__removeFromChangelist |
|
133 ) |
|
134 ) |
110 if self.vcs.version >= (1, 2, 0): |
135 if self.vcs.version >= (1, 2, 0): |
111 self.menu.addSeparator() |
136 self.menu.addSeparator() |
|
137 self.menuactions.append(self.menu.addAction(self.tr("Lock"), self.__lock)) |
112 self.menuactions.append( |
138 self.menuactions.append( |
113 self.menu.addAction(self.tr("Lock"), self.__lock)) |
139 self.menu.addAction(self.tr("Unlock"), self.__unlock) |
|
140 ) |
114 self.menuactions.append( |
141 self.menuactions.append( |
115 self.menu.addAction(self.tr("Unlock"), self.__unlock)) |
142 self.menu.addAction(self.tr("Break lock"), self.__breakLock) |
116 self.menuactions.append(self.menu.addAction( |
143 ) |
117 self.tr("Break lock"), |
144 self.menuactions.append( |
118 self.__breakLock)) |
145 self.menu.addAction(self.tr("Steal lock"), self.__stealLock) |
119 self.menuactions.append(self.menu.addAction( |
146 ) |
120 self.tr("Steal lock"), |
|
121 self.__stealLock)) |
|
122 self.menu.addSeparator() |
147 self.menu.addSeparator() |
123 self.menuactions.append(self.menu.addAction( |
148 self.menuactions.append( |
124 self.tr("Adjust column sizes"), |
149 self.menu.addAction(self.tr("Adjust column sizes"), self.__resizeColumns) |
125 self.__resizeColumns)) |
150 ) |
126 for act in self.menuactions: |
151 for act in self.menuactions: |
127 act.setEnabled(False) |
152 act.setEnabled(False) |
128 |
153 |
129 self.statusList.setContextMenuPolicy( |
154 self.statusList.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
130 Qt.ContextMenuPolicy.CustomContextMenu) |
155 self.statusList.customContextMenuRequested.connect(self.__showContextMenu) |
131 self.statusList.customContextMenuRequested.connect( |
156 |
132 self.__showContextMenu) |
|
133 |
|
134 self.modifiedIndicators = [ |
157 self.modifiedIndicators = [ |
135 self.tr(svnStatusMap[pysvn.wc_status_kind.added]), |
158 self.tr(svnStatusMap[pysvn.wc_status_kind.added]), |
136 self.tr(svnStatusMap[pysvn.wc_status_kind.deleted]), |
159 self.tr(svnStatusMap[pysvn.wc_status_kind.deleted]), |
137 self.tr(svnStatusMap[pysvn.wc_status_kind.modified]) |
160 self.tr(svnStatusMap[pysvn.wc_status_kind.modified]), |
138 ] |
161 ] |
139 |
162 |
140 self.missingIndicators = [ |
163 self.missingIndicators = [ |
141 self.tr(svnStatusMap[pysvn.wc_status_kind.missing]), |
164 self.tr(svnStatusMap[pysvn.wc_status_kind.missing]), |
142 ] |
165 ] |
143 |
166 |
144 self.unversionedIndicators = [ |
167 self.unversionedIndicators = [ |
145 self.tr(svnStatusMap[pysvn.wc_status_kind.unversioned]), |
168 self.tr(svnStatusMap[pysvn.wc_status_kind.unversioned]), |
146 ] |
169 ] |
147 |
170 |
148 self.lockedIndicators = [ |
171 self.lockedIndicators = [ |
149 self.tr('locked'), |
172 self.tr("locked"), |
150 ] |
173 ] |
151 |
174 |
152 self.stealBreakLockIndicators = [ |
175 self.stealBreakLockIndicators = [ |
153 self.tr('other lock'), |
176 self.tr("other lock"), |
154 self.tr('stolen lock'), |
177 self.tr("stolen lock"), |
155 self.tr('broken lock'), |
178 self.tr("broken lock"), |
156 ] |
179 ] |
157 |
180 |
158 self.unlockedIndicators = [ |
181 self.unlockedIndicators = [ |
159 self.tr('not locked'), |
182 self.tr("not locked"), |
160 ] |
183 ] |
161 |
184 |
162 self.lockinfo = { |
185 self.lockinfo = { |
163 ' ': self.tr('not locked'), |
186 " ": self.tr("not locked"), |
164 'L': self.tr('locked'), |
187 "L": self.tr("locked"), |
165 'O': self.tr('other lock'), |
188 "O": self.tr("other lock"), |
166 'S': self.tr('stolen lock'), |
189 "S": self.tr("stolen lock"), |
167 'B': self.tr('broken lock'), |
190 "B": self.tr("broken lock"), |
168 } |
191 } |
169 self.yesno = [ |
192 self.yesno = [ |
170 self.tr('no'), |
193 self.tr("no"), |
171 self.tr('yes'), |
194 self.tr("yes"), |
172 ] |
195 ] |
173 |
196 |
174 self.client = self.vcs.getClient() |
197 self.client = self.vcs.getClient() |
175 self.client.callback_cancel = self._clientCancelCallback |
198 self.client.callback_cancel = self._clientCancelCallback |
176 self.client.callback_get_login = self._clientLoginCallback |
199 self.client.callback_get_login = self._clientLoginCallback |
177 self.client.callback_ssl_server_trust_prompt = ( |
200 self.client.callback_ssl_server_trust_prompt = ( |
178 self._clientSslServerTrustPromptCallback |
201 self._clientSslServerTrustPromptCallback |
179 ) |
202 ) |
180 |
203 |
181 self.show() |
204 self.show() |
182 QApplication.processEvents() |
205 QApplication.processEvents() |
183 |
206 |
184 def __resort(self): |
207 def __resort(self): |
185 """ |
208 """ |
186 Private method to resort the tree. |
209 Private method to resort the tree. |
187 """ |
210 """ |
188 self.statusList.sortItems( |
211 self.statusList.sortItems( |
189 self.statusList.sortColumn(), |
212 self.statusList.sortColumn(), self.statusList.header().sortIndicatorOrder() |
190 self.statusList.header().sortIndicatorOrder()) |
213 ) |
191 |
214 |
192 def __resizeColumns(self): |
215 def __resizeColumns(self): |
193 """ |
216 """ |
194 Private method to resize the list columns. |
217 Private method to resize the list columns. |
195 """ |
218 """ |
196 self.statusList.header().resizeSections( |
219 self.statusList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents) |
197 QHeaderView.ResizeMode.ResizeToContents) |
|
198 self.statusList.header().setStretchLastSection(True) |
220 self.statusList.header().setStretchLastSection(True) |
199 |
221 |
200 def __generateItem(self, changelist, status, propStatus, locked, history, |
222 def __generateItem( |
201 switched, lockinfo, uptodate, revision, change, author, |
223 self, |
202 path): |
224 changelist, |
|
225 status, |
|
226 propStatus, |
|
227 locked, |
|
228 history, |
|
229 switched, |
|
230 lockinfo, |
|
231 uptodate, |
|
232 revision, |
|
233 change, |
|
234 author, |
|
235 path, |
|
236 ): |
203 """ |
237 """ |
204 Private method to generate a status item in the status list. |
238 Private method to generate a status item in the status list. |
205 |
239 |
206 @param changelist name of the changelist (string) |
240 @param changelist name of the changelist (string) |
207 @param status text status (pysvn.wc_status_kind) |
241 @param status text status (pysvn.wc_status_kind) |
208 @param propStatus property status (pysvn.wc_status_kind) |
242 @param propStatus property status (pysvn.wc_status_kind) |
209 @param locked locked flag (boolean) |
243 @param locked locked flag (boolean) |
210 @param history history flag (boolean) |
244 @param history history flag (boolean) |
284 |
317 |
285 self.statusFilterCombo.clear() |
318 self.statusFilterCombo.clear() |
286 self.__statusFilters = [] |
319 self.__statusFilters = [] |
287 self.statusList.clear() |
320 self.statusList.clear() |
288 self.shouldCancel = False |
321 self.shouldCancel = False |
289 |
322 |
290 self.buttonBox.button( |
323 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
291 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
324 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
292 self.buttonBox.button( |
325 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
293 QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
|
294 self.buttonBox.button( |
|
295 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
|
296 self.refreshButton.setEnabled(False) |
326 self.refreshButton.setEnabled(False) |
297 |
327 |
298 self.args = fn |
328 self.args = fn |
299 |
329 |
300 self.setWindowTitle(self.tr('Subversion Status')) |
330 self.setWindowTitle(self.tr("Subversion Status")) |
301 self.activateWindow() |
331 self.activateWindow() |
302 self.raise_() |
332 self.raise_() |
303 |
333 |
304 if isinstance(fn, list): |
334 if isinstance(fn, list): |
305 self.dname, fnames = self.vcs.splitPathList(fn) |
335 self.dname, fnames = self.vcs.splitPathList(fn) |
306 else: |
336 else: |
307 self.dname, fname = self.vcs.splitPath(fn) |
337 self.dname, fname = self.vcs.splitPath(fn) |
308 fnames = [fname] |
338 fnames = [fname] |
309 |
339 |
310 opts = self.vcs.options['global'] + self.vcs.options['status'] |
340 opts = self.vcs.options["global"] + self.vcs.options["status"] |
311 verbose = "--verbose" in opts |
341 verbose = "--verbose" in opts |
312 recurse = "--non-recursive" not in opts |
342 recurse = "--non-recursive" not in opts |
313 update = "--show-updates" in opts |
343 update = "--show-updates" in opts |
314 |
344 |
315 hideChangelistColumn = True |
345 hideChangelistColumn = True |
316 hidePropertyStatusColumn = True |
346 hidePropertyStatusColumn = True |
317 hideLockColumns = True |
347 hideLockColumns = True |
318 hideUpToDateColumn = True |
348 hideUpToDateColumn = True |
319 hideHistoryColumn = True |
349 hideHistoryColumn = True |
320 hideSwitchedColumn = True |
350 hideSwitchedColumn = True |
321 |
351 |
322 with EricOverrideCursor(): |
352 with EricOverrideCursor(): |
323 cwd = os.getcwd() |
353 cwd = os.getcwd() |
324 os.chdir(self.dname) |
354 os.chdir(self.dname) |
325 try: |
355 try: |
326 with EricMutexLocker(self.vcs.vcsExecutionMutex): |
356 with EricMutexLocker(self.vcs.vcsExecutionMutex): |
327 for name in fnames: |
357 for name in fnames: |
328 # step 1: determine changelists and their files |
358 # step 1: determine changelists and their files |
329 changelistsDict = {} |
359 changelistsDict = {} |
330 if hasattr(self.client, 'get_changelist'): |
360 if hasattr(self.client, "get_changelist"): |
331 if recurse: |
361 if recurse: |
332 depth = pysvn.depth.infinity |
362 depth = pysvn.depth.infinity |
333 else: |
363 else: |
334 depth = pysvn.depth.immediate |
364 depth = pysvn.depth.immediate |
335 changelists = self.client.get_changelist( |
365 changelists = self.client.get_changelist(name, depth=depth) |
336 name, depth=depth) |
|
337 for fpath, changelist in changelists: |
366 for fpath, changelist in changelists: |
338 fpath = Utilities.normcasepath(fpath) |
367 fpath = Utilities.normcasepath(fpath) |
339 changelistsDict[fpath] = changelist |
368 changelistsDict[fpath] = changelist |
340 hideChangelistColumn = ( |
369 hideChangelistColumn = ( |
341 hideChangelistColumn and len(changelistsDict) == 0 |
370 hideChangelistColumn and len(changelistsDict) == 0 |
342 ) |
371 ) |
343 |
372 |
344 # step 2: determine status of files |
373 # step 2: determine status of files |
345 allFiles = self.client.status( |
374 allFiles = self.client.status( |
346 name, recurse=recurse, get_all=verbose, |
375 name, |
347 ignore=True, update=update) |
376 recurse=recurse, |
|
377 get_all=verbose, |
|
378 ignore=True, |
|
379 update=update, |
|
380 ) |
348 for counter, file in enumerate(allFiles): |
381 for counter, file in enumerate(allFiles): |
349 uptodate = True |
382 uptodate = True |
350 if ( |
383 if file.repos_text_status != pysvn.wc_status_kind.none: |
351 file.repos_text_status != |
|
352 pysvn.wc_status_kind.none |
|
353 ): |
|
354 uptodate = ( |
384 uptodate = ( |
355 uptodate and |
385 uptodate |
356 file.repos_text_status != |
386 and file.repos_text_status |
357 pysvn.wc_status_kind.modified |
387 != pysvn.wc_status_kind.modified |
358 ) |
388 ) |
359 if ( |
389 if file.repos_prop_status != pysvn.wc_status_kind.none: |
360 file.repos_prop_status != |
|
361 pysvn.wc_status_kind.none |
|
362 ): |
|
363 uptodate = ( |
390 uptodate = ( |
364 uptodate and |
391 uptodate |
365 file.repos_prop_status != |
392 and file.repos_prop_status |
366 pysvn.wc_status_kind.modified |
393 != pysvn.wc_status_kind.modified |
367 ) |
394 ) |
368 |
395 |
369 lockState = " " |
396 lockState = " " |
370 if ( |
397 if ( |
371 file.entry is not None and |
398 file.entry is not None |
372 hasattr(file.entry, 'lock_token') and |
399 and hasattr(file.entry, "lock_token") |
373 file.entry.lock_token is not None |
400 and file.entry.lock_token is not None |
374 ): |
401 ): |
375 lockState = "L" |
402 lockState = "L" |
376 if hasattr(file, 'repos_lock') and update: |
403 if hasattr(file, "repos_lock") and update: |
377 if ( |
404 if lockState == "L" and file.repos_lock is None: |
378 lockState == "L" and |
|
379 file.repos_lock is None |
|
380 ): |
|
381 lockState = "B" |
405 lockState = "B" |
382 elif ( |
406 elif lockState == " " and file.repos_lock is not None: |
383 lockState == " " and |
|
384 file.repos_lock is not None |
|
385 ): |
|
386 lockState = "O" |
407 lockState = "O" |
387 elif ( |
408 elif ( |
388 lockState == "L" and |
409 lockState == "L" |
389 file.repos_lock is not None and |
410 and file.repos_lock is not None |
390 file.entry.lock_token != |
411 and file.entry.lock_token |
391 file.repos_lock["token"] |
412 != file.repos_lock["token"] |
392 ): |
413 ): |
393 lockState = "S" |
414 lockState = "S" |
394 |
415 |
395 fpath = Utilities.normcasepath( |
416 fpath = Utilities.normcasepath( |
396 os.path.join(self.dname, file.path)) |
417 os.path.join(self.dname, file.path) |
397 changelist = (changelistsDict[fpath] |
418 ) |
398 if fpath in changelistsDict else "") |
419 changelist = ( |
399 |
420 changelistsDict[fpath] |
|
421 if fpath in changelistsDict |
|
422 else "" |
|
423 ) |
|
424 |
400 hidePropertyStatusColumn = ( |
425 hidePropertyStatusColumn = ( |
401 hidePropertyStatusColumn and |
426 hidePropertyStatusColumn |
402 file.prop_status in [ |
427 and file.prop_status |
|
428 in [ |
403 pysvn.wc_status_kind.none, |
429 pysvn.wc_status_kind.none, |
404 pysvn.wc_status_kind.normal |
430 pysvn.wc_status_kind.normal, |
405 ] |
431 ] |
406 ) |
432 ) |
407 hideLockColumns = ( |
433 hideLockColumns = ( |
408 hideLockColumns and |
434 hideLockColumns |
409 not file.is_locked and |
435 and not file.is_locked |
410 lockState == " " |
436 and lockState == " " |
411 ) |
437 ) |
412 hideUpToDateColumn = ( |
438 hideUpToDateColumn = hideUpToDateColumn and uptodate |
413 hideUpToDateColumn and uptodate |
439 hideHistoryColumn = hideHistoryColumn and not file.is_copied |
|
440 hideSwitchedColumn = ( |
|
441 hideSwitchedColumn and not file.is_switched |
414 ) |
442 ) |
415 hideHistoryColumn = ( |
443 |
416 hideHistoryColumn and |
|
417 not file.is_copied |
|
418 ) |
|
419 hideSwitchedColumn = ( |
|
420 hideSwitchedColumn and |
|
421 not file.is_switched |
|
422 ) |
|
423 |
|
424 self.__generateItem( |
444 self.__generateItem( |
425 changelist, |
445 changelist, |
426 file.text_status, |
446 file.text_status, |
427 file.prop_status, |
447 file.prop_status, |
428 file.is_locked, |
448 file.is_locked, |
429 file.is_copied, |
449 file.is_copied, |
430 file.is_switched, |
450 file.is_switched, |
431 lockState, |
451 lockState, |
432 uptodate, |
452 uptodate, |
433 file.entry.revision.number if file.entry |
453 file.entry.revision.number if file.entry else "", |
434 else "", |
454 file.entry.commit_revision.number if file.entry else "", |
435 file.entry.commit_revision.number |
|
436 if file.entry else "", |
|
437 file.entry.commit_author if file.entry else "", |
455 file.entry.commit_author if file.entry else "", |
438 file.path |
456 file.path, |
439 ) |
457 ) |
440 if ( |
458 if counter % 30 == 0 and self._clientCancelCallback(): |
441 counter % 30 == 0 and |
|
442 self._clientCancelCallback() |
|
443 ): |
|
444 # check for cancel every 30 items |
459 # check for cancel every 30 items |
445 break |
460 break |
446 if self._clientCancelCallback(): |
461 if self._clientCancelCallback(): |
447 break |
462 break |
448 except pysvn.ClientError as e: |
463 except pysvn.ClientError as e: |
449 self.__showError(e.args[0] + '\n') |
464 self.__showError(e.args[0] + "\n") |
450 |
465 |
451 self.statusList.setColumnHidden(self.__propStatusColumn, |
466 self.statusList.setColumnHidden( |
452 hidePropertyStatusColumn) |
467 self.__propStatusColumn, hidePropertyStatusColumn |
453 self.statusList.setColumnHidden(self.__lockedColumn, |
468 ) |
454 hideLockColumns) |
469 self.statusList.setColumnHidden(self.__lockedColumn, hideLockColumns) |
455 self.statusList.setColumnHidden(self.__lockinfoColumn, |
470 self.statusList.setColumnHidden(self.__lockinfoColumn, hideLockColumns) |
456 hideLockColumns) |
471 self.statusList.setColumnHidden(self.__upToDateColumn, hideUpToDateColumn) |
457 self.statusList.setColumnHidden(self.__upToDateColumn, |
472 self.statusList.setColumnHidden(self.__historyColumn, hideHistoryColumn) |
458 hideUpToDateColumn) |
473 self.statusList.setColumnHidden(self.__switchedColumn, hideSwitchedColumn) |
459 self.statusList.setColumnHidden(self.__historyColumn, |
474 self.statusList.setColumnHidden( |
460 hideHistoryColumn) |
475 self.__changelistColumn, hideChangelistColumn |
461 self.statusList.setColumnHidden(self.__switchedColumn, |
476 ) |
462 hideSwitchedColumn) |
|
463 self.statusList.setColumnHidden(self.__changelistColumn, |
|
464 hideChangelistColumn) |
|
465 self.__finish() |
477 self.__finish() |
466 os.chdir(cwd) |
478 os.chdir(cwd) |
467 |
479 |
468 def __finish(self): |
480 def __finish(self): |
469 """ |
481 """ |
470 Private slot called when the process finished or the user pressed |
482 Private slot called when the process finished or the user pressed |
471 the button. |
483 the button. |
472 """ |
484 """ |
473 self.buttonBox.button( |
485 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True) |
474 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
486 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
475 self.buttonBox.button( |
487 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True) |
476 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
488 |
477 self.buttonBox.button( |
|
478 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
479 |
|
480 self.refreshButton.setEnabled(True) |
489 self.refreshButton.setEnabled(True) |
481 self.__updateButtons() |
490 self.__updateButtons() |
482 self.__updateCommitButton() |
491 self.__updateCommitButton() |
483 |
492 |
484 self.__statusFilters.sort() |
493 self.__statusFilters.sort() |
485 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) |
494 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) |
486 self.statusFilterCombo.addItems(self.__statusFilters) |
495 self.statusFilterCombo.addItems(self.__statusFilters) |
487 |
496 |
488 for act in self.menuactions: |
497 for act in self.menuactions: |
489 act.setEnabled(True) |
498 act.setEnabled(True) |
490 |
499 |
491 self.__resizeColumns() |
500 self.__resizeColumns() |
492 self.__resort() |
501 self.__resort() |
493 |
502 |
494 self._cancel() |
503 self._cancel() |
495 |
504 |
496 def on_buttonBox_clicked(self, button): |
505 def on_buttonBox_clicked(self, button): |
497 """ |
506 """ |
498 Private slot called by a button of the button box clicked. |
507 Private slot called by a button of the button box clicked. |
499 |
508 |
500 @param button button that was clicked (QAbstractButton) |
509 @param button button that was clicked (QAbstractButton) |
501 """ |
510 """ |
502 if button == self.buttonBox.button( |
511 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
503 QDialogButtonBox.StandardButton.Close |
|
504 ): |
|
505 self.close() |
512 self.close() |
506 elif button == self.buttonBox.button( |
513 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
507 QDialogButtonBox.StandardButton.Cancel |
|
508 ): |
|
509 self.__finish() |
514 self.__finish() |
510 elif button == self.refreshButton: |
515 elif button == self.refreshButton: |
511 self.on_refreshButton_clicked() |
516 self.on_refreshButton_clicked() |
512 |
517 |
513 @pyqtSlot() |
518 @pyqtSlot() |
514 def on_refreshButton_clicked(self): |
519 def on_refreshButton_clicked(self): |
515 """ |
520 """ |
516 Private slot to refresh the status display. |
521 Private slot to refresh the status display. |
517 """ |
522 """ |
518 self.start(self.args) |
523 self.start(self.args) |
519 |
524 |
520 def __showError(self, msg): |
525 def __showError(self, msg): |
521 """ |
526 """ |
522 Private slot to show an error message. |
527 Private slot to show an error message. |
523 |
528 |
524 @param msg error message to show (string) |
529 @param msg error message to show (string) |
525 """ |
530 """ |
526 self.errorGroup.show() |
531 self.errorGroup.show() |
527 self.errors.insertPlainText(msg) |
532 self.errors.insertPlainText(msg) |
528 self.errors.ensureCursorVisible() |
533 self.errors.ensureCursorVisible() |
529 |
534 |
530 def __updateButtons(self): |
535 def __updateButtons(self): |
531 """ |
536 """ |
532 Private method to update the VCS buttons status. |
537 Private method to update the VCS buttons status. |
533 """ |
538 """ |
534 modified = len(self.__getModifiedItems()) |
539 modified = len(self.__getModifiedItems()) |
563 topItem.setHidden(False) |
568 topItem.setHidden(False) |
564 else: |
569 else: |
565 for topIndex in range(self.statusList.topLevelItemCount()): |
570 for topIndex in range(self.statusList.topLevelItemCount()): |
566 topItem = self.statusList.topLevelItem(topIndex) |
571 topItem = self.statusList.topLevelItem(topIndex) |
567 topItem.setHidden(topItem.text(self.__statusColumn) != txt) |
572 topItem.setHidden(topItem.text(self.__statusColumn) != txt) |
568 |
573 |
569 @pyqtSlot(QTreeWidgetItem, int) |
574 @pyqtSlot(QTreeWidgetItem, int) |
570 def on_statusList_itemChanged(self, item, column): |
575 def on_statusList_itemChanged(self, item, column): |
571 """ |
576 """ |
572 Private slot to act upon item changes. |
577 Private slot to act upon item changes. |
573 |
578 |
574 @param item reference to the changed item (QTreeWidgetItem) |
579 @param item reference to the changed item (QTreeWidgetItem) |
575 @param column index of column that changed (integer) |
580 @param column index of column that changed (integer) |
576 """ |
581 """ |
577 if column == self.__toBeCommittedColumn: |
582 if column == self.__toBeCommittedColumn: |
578 self.__updateCommitButton() |
583 self.__updateCommitButton() |
579 |
584 |
580 @pyqtSlot() |
585 @pyqtSlot() |
581 def on_statusList_itemSelectionChanged(self): |
586 def on_statusList_itemSelectionChanged(self): |
582 """ |
587 """ |
583 Private slot to act upon changes of selected items. |
588 Private slot to act upon changes of selected items. |
584 """ |
589 """ |
585 self.__updateButtons() |
590 self.__updateButtons() |
586 |
591 |
587 @pyqtSlot() |
592 @pyqtSlot() |
588 def on_commitButton_clicked(self): |
593 def on_commitButton_clicked(self): |
589 """ |
594 """ |
590 Private slot to handle the press of the Commit button. |
595 Private slot to handle the press of the Commit button. |
591 """ |
596 """ |
592 self.__commit() |
597 self.__commit() |
593 |
598 |
594 @pyqtSlot() |
599 @pyqtSlot() |
595 def on_addButton_clicked(self): |
600 def on_addButton_clicked(self): |
596 """ |
601 """ |
597 Private slot to handle the press of the Add button. |
602 Private slot to handle the press of the Add button. |
598 """ |
603 """ |
599 self.__add() |
604 self.__add() |
600 |
605 |
601 @pyqtSlot() |
606 @pyqtSlot() |
602 def on_diffButton_clicked(self): |
607 def on_diffButton_clicked(self): |
603 """ |
608 """ |
604 Private slot to handle the press of the Differences button. |
609 Private slot to handle the press of the Differences button. |
605 """ |
610 """ |
606 self.__diff() |
611 self.__diff() |
607 |
612 |
608 @pyqtSlot() |
613 @pyqtSlot() |
609 def on_sbsDiffButton_clicked(self): |
614 def on_sbsDiffButton_clicked(self): |
610 """ |
615 """ |
611 Private slot to handle the press of the Side-by-Side Diff button. |
616 Private slot to handle the press of the Side-by-Side Diff button. |
612 """ |
617 """ |
613 self.__sbsDiff() |
618 self.__sbsDiff() |
614 |
619 |
615 @pyqtSlot() |
620 @pyqtSlot() |
616 def on_revertButton_clicked(self): |
621 def on_revertButton_clicked(self): |
617 """ |
622 """ |
618 Private slot to handle the press of the Revert button. |
623 Private slot to handle the press of the Revert button. |
619 """ |
624 """ |
620 self.__revert() |
625 self.__revert() |
621 |
626 |
622 @pyqtSlot() |
627 @pyqtSlot() |
623 def on_restoreButton_clicked(self): |
628 def on_restoreButton_clicked(self): |
624 """ |
629 """ |
625 Private slot to handle the press of the Restore button. |
630 Private slot to handle the press of the Restore button. |
626 """ |
631 """ |
627 self.__restoreMissing() |
632 self.__restoreMissing() |
628 |
633 |
629 ########################################################################### |
634 ########################################################################### |
630 ## Context menu handling methods |
635 ## Context menu handling methods |
631 ########################################################################### |
636 ########################################################################### |
632 |
637 |
633 def __showContextMenu(self, coord): |
638 def __showContextMenu(self, coord): |
634 """ |
639 """ |
635 Private slot to show the context menu of the status list. |
640 Private slot to show the context menu of the status list. |
636 |
641 |
637 @param coord the position of the mouse pointer (QPoint) |
642 @param coord the position of the mouse pointer (QPoint) |
638 """ |
643 """ |
639 self.menu.popup(self.statusList.mapToGlobal(coord)) |
644 self.menu.popup(self.statusList.mapToGlobal(coord)) |
640 |
645 |
641 def __commit(self): |
646 def __commit(self): |
642 """ |
647 """ |
643 Private slot to handle the Commit context menu entry. |
648 Private slot to handle the Commit context menu entry. |
644 """ |
649 """ |
645 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
650 names = [ |
646 for itm in self.__getCommitableItems()] |
651 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
652 for itm in self.__getCommitableItems() |
|
653 ] |
647 if not names: |
654 if not names: |
648 EricMessageBox.information( |
655 EricMessageBox.information( |
649 self, |
656 self, |
650 self.tr("Commit"), |
657 self.tr("Commit"), |
651 self.tr("""There are no entries selected to be""" |
658 self.tr("""There are no entries selected to be""" """ committed."""), |
652 """ committed.""")) |
659 ) |
653 return |
660 return |
654 |
661 |
655 if Preferences.getVCS("AutoSaveFiles"): |
662 if Preferences.getVCS("AutoSaveFiles"): |
656 vm = ericApp().getObject("ViewManager") |
663 vm = ericApp().getObject("ViewManager") |
657 for name in names: |
664 for name in names: |
658 vm.saveEditor(name) |
665 vm.saveEditor(name) |
659 self.vcs.vcsCommit(names, '') |
666 self.vcs.vcsCommit(names, "") |
660 |
667 |
661 def __committed(self): |
668 def __committed(self): |
662 """ |
669 """ |
663 Private slot called after the commit has finished. |
670 Private slot called after the commit has finished. |
664 """ |
671 """ |
665 if self.isVisible(): |
672 if self.isVisible(): |
666 self.on_refreshButton_clicked() |
673 self.on_refreshButton_clicked() |
667 self.vcs.checkVCSStatus() |
674 self.vcs.checkVCSStatus() |
668 |
675 |
669 def __commitSelectAll(self): |
676 def __commitSelectAll(self): |
670 """ |
677 """ |
671 Private slot to select all entries for commit. |
678 Private slot to select all entries for commit. |
672 """ |
679 """ |
673 self.__commitSelect(True) |
680 self.__commitSelect(True) |
674 |
681 |
675 def __commitDeselectAll(self): |
682 def __commitDeselectAll(self): |
676 """ |
683 """ |
677 Private slot to deselect all entries from commit. |
684 Private slot to deselect all entries from commit. |
678 """ |
685 """ |
679 self.__commitSelect(False) |
686 self.__commitSelect(False) |
680 |
687 |
681 def __add(self): |
688 def __add(self): |
682 """ |
689 """ |
683 Private slot to handle the Add context menu entry. |
690 Private slot to handle the Add context menu entry. |
684 """ |
691 """ |
685 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
692 names = [ |
686 for itm in self.__getUnversionedItems()] |
693 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
694 for itm in self.__getUnversionedItems() |
|
695 ] |
687 if not names: |
696 if not names: |
688 EricMessageBox.information( |
697 EricMessageBox.information( |
689 self, |
698 self, |
690 self.tr("Add"), |
699 self.tr("Add"), |
691 self.tr("""There are no unversioned entries""" |
700 self.tr( |
692 """ available/selected.""")) |
701 """There are no unversioned entries""" """ available/selected.""" |
693 return |
702 ), |
694 |
703 ) |
|
704 return |
|
705 |
695 self.vcs.vcsAdd(names) |
706 self.vcs.vcsAdd(names) |
696 self.on_refreshButton_clicked() |
707 self.on_refreshButton_clicked() |
697 |
708 |
698 project = ericApp().getObject("Project") |
709 project = ericApp().getObject("Project") |
699 for name in names: |
710 for name in names: |
700 project.getModel().updateVCSStatus(name) |
711 project.getModel().updateVCSStatus(name) |
701 self.vcs.checkVCSStatus() |
712 self.vcs.checkVCSStatus() |
702 |
713 |
703 def __revert(self): |
714 def __revert(self): |
704 """ |
715 """ |
705 Private slot to handle the Revert context menu entry. |
716 Private slot to handle the Revert context menu entry. |
706 """ |
717 """ |
707 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
718 names = [ |
708 for itm in self.__getModifiedItems()] |
719 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
720 for itm in self.__getModifiedItems() |
|
721 ] |
709 if not names: |
722 if not names: |
710 EricMessageBox.information( |
723 EricMessageBox.information( |
711 self, |
724 self, |
712 self.tr("Revert"), |
725 self.tr("Revert"), |
713 self.tr("""There are no uncommitted changes""" |
726 self.tr( |
714 """ available/selected.""")) |
727 """There are no uncommitted changes""" """ available/selected.""" |
715 return |
728 ), |
716 |
729 ) |
|
730 return |
|
731 |
717 self.vcs.vcsRevert(names) |
732 self.vcs.vcsRevert(names) |
718 self.raise_() |
733 self.raise_() |
719 self.activateWindow() |
734 self.activateWindow() |
720 self.on_refreshButton_clicked() |
735 self.on_refreshButton_clicked() |
721 |
736 |
722 project = ericApp().getObject("Project") |
737 project = ericApp().getObject("Project") |
723 for name in names: |
738 for name in names: |
724 project.getModel().updateVCSStatus(name) |
739 project.getModel().updateVCSStatus(name) |
725 self.vcs.checkVCSStatus() |
740 self.vcs.checkVCSStatus() |
726 |
741 |
727 def __restoreMissing(self): |
742 def __restoreMissing(self): |
728 """ |
743 """ |
729 Private slot to handle the Restore Missing context menu entry. |
744 Private slot to handle the Restore Missing context menu entry. |
730 """ |
745 """ |
731 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
746 names = [ |
732 for itm in self.__getMissingItems()] |
747 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
748 for itm in self.__getMissingItems() |
|
749 ] |
733 if not names: |
750 if not names: |
734 EricMessageBox.information( |
751 EricMessageBox.information( |
735 self, |
752 self, |
736 self.tr("Restore Missing"), |
753 self.tr("Restore Missing"), |
737 self.tr("""There are no missing entries""" |
754 self.tr("""There are no missing entries""" """ available/selected."""), |
738 """ available/selected.""")) |
755 ) |
739 return |
756 return |
740 |
757 |
741 self.vcs.vcsRevert(names) |
758 self.vcs.vcsRevert(names) |
742 self.on_refreshButton_clicked() |
759 self.on_refreshButton_clicked() |
743 self.vcs.checkVCSStatus() |
760 self.vcs.checkVCSStatus() |
744 |
761 |
745 def __diff(self): |
762 def __diff(self): |
746 """ |
763 """ |
747 Private slot to handle the Diff context menu entry. |
764 Private slot to handle the Diff context menu entry. |
748 """ |
765 """ |
749 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
766 names = [ |
750 for itm in self.__getModifiedItems()] |
767 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
768 for itm in self.__getModifiedItems() |
|
769 ] |
751 if not names: |
770 if not names: |
752 EricMessageBox.information( |
771 EricMessageBox.information( |
753 self, |
772 self, |
754 self.tr("Differences"), |
773 self.tr("Differences"), |
755 self.tr("""There are no uncommitted changes""" |
774 self.tr( |
756 """ available/selected.""")) |
775 """There are no uncommitted changes""" """ available/selected.""" |
757 return |
776 ), |
758 |
777 ) |
|
778 return |
|
779 |
759 if self.diff is None: |
780 if self.diff is None: |
760 from .SvnDiffDialog import SvnDiffDialog |
781 from .SvnDiffDialog import SvnDiffDialog |
|
782 |
761 self.diff = SvnDiffDialog(self.vcs) |
783 self.diff = SvnDiffDialog(self.vcs) |
762 self.diff.show() |
784 self.diff.show() |
763 QApplication.processEvents() |
785 QApplication.processEvents() |
764 self.diff.start(names, refreshable=True) |
786 self.diff.start(names, refreshable=True) |
765 |
787 |
766 def __sbsDiff(self): |
788 def __sbsDiff(self): |
767 """ |
789 """ |
768 Private slot to handle the Side-by-Side Diff context menu entry. |
790 Private slot to handle the Side-by-Side Diff context menu entry. |
769 """ |
791 """ |
770 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
792 names = [ |
771 for itm in self.__getModifiedItems()] |
793 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
794 for itm in self.__getModifiedItems() |
|
795 ] |
772 if not names: |
796 if not names: |
773 EricMessageBox.information( |
797 EricMessageBox.information( |
774 self, |
798 self, |
775 self.tr("Side-by-Side Diff"), |
799 self.tr("Side-by-Side Diff"), |
776 self.tr("""There are no uncommitted changes""" |
800 self.tr( |
777 """ available/selected.""")) |
801 """There are no uncommitted changes""" """ available/selected.""" |
|
802 ), |
|
803 ) |
778 return |
804 return |
779 elif len(names) > 1: |
805 elif len(names) > 1: |
780 EricMessageBox.information( |
806 EricMessageBox.information( |
781 self, |
807 self, |
782 self.tr("Side-by-Side Diff"), |
808 self.tr("Side-by-Side Diff"), |
783 self.tr("""Only one file with uncommitted changes""" |
809 self.tr( |
784 """ must be selected.""")) |
810 """Only one file with uncommitted changes""" |
785 return |
811 """ must be selected.""" |
786 |
812 ), |
|
813 ) |
|
814 return |
|
815 |
787 self.vcs.vcsSbsDiff(names[0]) |
816 self.vcs.vcsSbsDiff(names[0]) |
788 |
817 |
789 def __lock(self): |
818 def __lock(self): |
790 """ |
819 """ |
791 Private slot to handle the Lock context menu entry. |
820 Private slot to handle the Lock context menu entry. |
792 """ |
821 """ |
793 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
822 names = [ |
794 for itm in self.__getLockActionItems(self.unlockedIndicators)] |
823 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
824 for itm in self.__getLockActionItems(self.unlockedIndicators) |
|
825 ] |
795 if not names: |
826 if not names: |
796 EricMessageBox.information( |
827 EricMessageBox.information( |
797 self, |
828 self, |
798 self.tr("Lock"), |
829 self.tr("Lock"), |
799 self.tr("""There are no unlocked files""" |
830 self.tr("""There are no unlocked files""" """ available/selected."""), |
800 """ available/selected.""")) |
831 ) |
801 return |
832 return |
802 |
833 |
803 self.vcs.svnLock(names, parent=self) |
834 self.vcs.svnLock(names, parent=self) |
804 self.on_refreshButton_clicked() |
835 self.on_refreshButton_clicked() |
805 |
836 |
806 def __unlock(self): |
837 def __unlock(self): |
807 """ |
838 """ |
808 Private slot to handle the Unlock context menu entry. |
839 Private slot to handle the Unlock context menu entry. |
809 """ |
840 """ |
810 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
841 names = [ |
811 for itm in self.__getLockActionItems(self.lockedIndicators)] |
842 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
843 for itm in self.__getLockActionItems(self.lockedIndicators) |
|
844 ] |
812 if not names: |
845 if not names: |
813 EricMessageBox.information( |
846 EricMessageBox.information( |
814 self, |
847 self, |
815 self.tr("Unlock"), |
848 self.tr("Unlock"), |
816 self.tr("""There are no locked files""" |
849 self.tr("""There are no locked files""" """ available/selected."""), |
817 """ available/selected.""")) |
850 ) |
818 return |
851 return |
819 |
852 |
820 self.vcs.svnUnlock(names, parent=self) |
853 self.vcs.svnUnlock(names, parent=self) |
821 self.on_refreshButton_clicked() |
854 self.on_refreshButton_clicked() |
822 |
855 |
823 def __breakLock(self): |
856 def __breakLock(self): |
824 """ |
857 """ |
825 Private slot to handle the Break Lock context menu entry. |
858 Private slot to handle the Break Lock context menu entry. |
826 """ |
859 """ |
827 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
860 names = [ |
828 for itm in self.__getLockActionItems( |
861 os.path.join(self.dname, itm.text(self.__pathColumn)) |
829 self.stealBreakLockIndicators)] |
862 for itm in self.__getLockActionItems(self.stealBreakLockIndicators) |
|
863 ] |
830 if not names: |
864 if not names: |
831 EricMessageBox.information( |
865 EricMessageBox.information( |
832 self, |
866 self, |
833 self.tr("Break Lock"), |
867 self.tr("Break Lock"), |
834 self.tr("""There are no locked files""" |
868 self.tr("""There are no locked files""" """ available/selected."""), |
835 """ available/selected.""")) |
869 ) |
836 return |
870 return |
837 |
871 |
838 self.vcs.svnUnlock(names, parent=self, breakIt=True) |
872 self.vcs.svnUnlock(names, parent=self, breakIt=True) |
839 self.on_refreshButton_clicked() |
873 self.on_refreshButton_clicked() |
840 |
874 |
841 def __stealLock(self): |
875 def __stealLock(self): |
842 """ |
876 """ |
843 Private slot to handle the Break Lock context menu entry. |
877 Private slot to handle the Break Lock context menu entry. |
844 """ |
878 """ |
845 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
879 names = [ |
846 for itm in self.__getLockActionItems( |
880 os.path.join(self.dname, itm.text(self.__pathColumn)) |
847 self.stealBreakLockIndicators)] |
881 for itm in self.__getLockActionItems(self.stealBreakLockIndicators) |
|
882 ] |
848 if not names: |
883 if not names: |
849 EricMessageBox.information( |
884 EricMessageBox.information( |
850 self, |
885 self, |
851 self.tr("Steal Lock"), |
886 self.tr("Steal Lock"), |
852 self.tr("""There are no locked files""" |
887 self.tr("""There are no locked files""" """ available/selected."""), |
853 """ available/selected.""")) |
888 ) |
854 return |
889 return |
855 |
890 |
856 self.vcs.svnLock(names, parent=self, stealIt=True) |
891 self.vcs.svnLock(names, parent=self, stealIt=True) |
857 self.on_refreshButton_clicked() |
892 self.on_refreshButton_clicked() |
858 |
893 |
859 def __addToChangelist(self): |
894 def __addToChangelist(self): |
860 """ |
895 """ |
861 Private slot to add entries to a changelist. |
896 Private slot to add entries to a changelist. |
862 """ |
897 """ |
863 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
898 names = [ |
864 for itm in self.__getNonChangelistItems()] |
899 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
900 for itm in self.__getNonChangelistItems() |
|
901 ] |
865 if not names: |
902 if not names: |
866 EricMessageBox.information( |
903 EricMessageBox.information( |
867 self, |
904 self, |
868 self.tr("Remove from Changelist"), |
905 self.tr("Remove from Changelist"), |
869 self.tr( |
906 self.tr( |
870 """There are no files available/selected not """ |
907 """There are no files available/selected not """ |
871 """belonging to a changelist.""" |
908 """belonging to a changelist.""" |
872 ) |
909 ), |
873 ) |
910 ) |
874 return |
911 return |
875 self.vcs.svnAddToChangelist(names) |
912 self.vcs.svnAddToChangelist(names) |
876 self.on_refreshButton_clicked() |
913 self.on_refreshButton_clicked() |
877 |
914 |
878 def __removeFromChangelist(self): |
915 def __removeFromChangelist(self): |
879 """ |
916 """ |
880 Private slot to remove entries from their changelists. |
917 Private slot to remove entries from their changelists. |
881 """ |
918 """ |
882 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
919 names = [ |
883 for itm in self.__getChangelistItems()] |
920 os.path.join(self.dname, itm.text(self.__pathColumn)) |
|
921 for itm in self.__getChangelistItems() |
|
922 ] |
884 if not names: |
923 if not names: |
885 EricMessageBox.information( |
924 EricMessageBox.information( |
886 self, |
925 self, |
887 self.tr("Remove from Changelist"), |
926 self.tr("Remove from Changelist"), |
888 self.tr( |
927 self.tr( |
889 """There are no files available/selected belonging""" |
928 """There are no files available/selected belonging""" |
890 """ to a changelist.""" |
929 """ to a changelist.""" |
891 ) |
930 ), |
892 ) |
931 ) |
893 return |
932 return |
894 self.vcs.svnRemoveFromChangelist(names) |
933 self.vcs.svnRemoveFromChangelist(names) |
895 self.on_refreshButton_clicked() |
934 self.on_refreshButton_clicked() |
896 |
935 |
897 def __getCommitableItems(self): |
936 def __getCommitableItems(self): |
898 """ |
937 """ |
899 Private method to retrieve all entries the user wants to commit. |
938 Private method to retrieve all entries the user wants to commit. |
900 |
939 |
901 @return list of all items, the user has checked |
940 @return list of all items, the user has checked |
902 """ |
941 """ |
903 commitableItems = [] |
942 commitableItems = [] |
904 for index in range(self.statusList.topLevelItemCount()): |
943 for index in range(self.statusList.topLevelItemCount()): |
905 itm = self.statusList.topLevelItem(index) |
944 itm = self.statusList.topLevelItem(index) |
906 if ( |
945 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked: |
907 itm.checkState(self.__toBeCommittedColumn) == |
|
908 Qt.CheckState.Checked |
|
909 ): |
|
910 commitableItems.append(itm) |
946 commitableItems.append(itm) |
911 return commitableItems |
947 return commitableItems |
912 |
948 |
913 def __getModifiedItems(self): |
949 def __getModifiedItems(self): |
914 """ |
950 """ |
915 Private method to retrieve all entries, that have a modified status. |
951 Private method to retrieve all entries, that have a modified status. |
916 |
952 |
917 @return list of all items with a modified status |
953 @return list of all items with a modified status |
918 """ |
954 """ |
919 modifiedItems = [] |
955 modifiedItems = [] |
920 for itm in self.statusList.selectedItems(): |
956 for itm in self.statusList.selectedItems(): |
921 if ( |
957 if ( |
922 itm.text(self.__statusColumn) in self.modifiedIndicators or |
958 itm.text(self.__statusColumn) in self.modifiedIndicators |
923 itm.text(self.__propStatusColumn) in self.modifiedIndicators |
959 or itm.text(self.__propStatusColumn) in self.modifiedIndicators |
924 ): |
960 ): |
925 modifiedItems.append(itm) |
961 modifiedItems.append(itm) |
926 return modifiedItems |
962 return modifiedItems |
927 |
963 |
928 def __getUnversionedItems(self): |
964 def __getUnversionedItems(self): |
929 """ |
965 """ |
930 Private method to retrieve all entries, that have an |
966 Private method to retrieve all entries, that have an |
931 unversioned status. |
967 unversioned status. |
932 |
968 |
933 @return list of all items with an unversioned status |
969 @return list of all items with an unversioned status |
934 """ |
970 """ |
935 unversionedItems = [] |
971 unversionedItems = [] |
936 for itm in self.statusList.selectedItems(): |
972 for itm in self.statusList.selectedItems(): |
937 if itm.text(self.__statusColumn) in self.unversionedIndicators: |
973 if itm.text(self.__statusColumn) in self.unversionedIndicators: |
938 unversionedItems.append(itm) |
974 unversionedItems.append(itm) |
939 return unversionedItems |
975 return unversionedItems |
940 |
976 |
941 def __getMissingItems(self): |
977 def __getMissingItems(self): |
942 """ |
978 """ |
943 Private method to retrieve all entries, that have a missing status. |
979 Private method to retrieve all entries, that have a missing status. |
944 |
980 |
945 @return list of all items with a missing status |
981 @return list of all items with a missing status |
946 """ |
982 """ |
947 missingItems = [] |
983 missingItems = [] |
948 for itm in self.statusList.selectedItems(): |
984 for itm in self.statusList.selectedItems(): |
949 if itm.text(self.__statusColumn) in self.missingIndicators: |
985 if itm.text(self.__statusColumn) in self.missingIndicators: |
950 missingItems.append(itm) |
986 missingItems.append(itm) |
951 return missingItems |
987 return missingItems |
952 |
988 |
953 def __getLockActionItems(self, indicators): |
989 def __getLockActionItems(self, indicators): |
954 """ |
990 """ |
955 Private method to retrieve all entries, that have a locked status. |
991 Private method to retrieve all entries, that have a locked status. |
956 |
992 |
957 @param indicators list of indicators to check against (list of strings) |
993 @param indicators list of indicators to check against (list of strings) |
958 @return list of all items with a locked status |
994 @return list of all items with a locked status |
959 """ |
995 """ |
960 lockitems = [] |
996 lockitems = [] |
961 for itm in self.statusList.selectedItems(): |
997 for itm in self.statusList.selectedItems(): |
962 if itm.text(self.__lockinfoColumn) in indicators: |
998 if itm.text(self.__lockinfoColumn) in indicators: |
963 lockitems.append(itm) |
999 lockitems.append(itm) |
964 return lockitems |
1000 return lockitems |
965 |
1001 |
966 def __getChangelistItems(self): |
1002 def __getChangelistItems(self): |
967 """ |
1003 """ |
968 Private method to retrieve all entries, that are members of |
1004 Private method to retrieve all entries, that are members of |
969 a changelist. |
1005 a changelist. |
970 |
1006 |
971 @return list of all items belonging to a changelist |
1007 @return list of all items belonging to a changelist |
972 """ |
1008 """ |
973 clitems = [] |
1009 clitems = [] |
974 for itm in self.statusList.selectedItems(): |
1010 for itm in self.statusList.selectedItems(): |
975 if itm.text(self.__changelistColumn): |
1011 if itm.text(self.__changelistColumn): |
976 clitems.append(itm) |
1012 clitems.append(itm) |
977 return clitems |
1013 return clitems |
978 |
1014 |
979 def __getNonChangelistItems(self): |
1015 def __getNonChangelistItems(self): |
980 """ |
1016 """ |
981 Private method to retrieve all entries, that are not members of |
1017 Private method to retrieve all entries, that are not members of |
982 a changelist. |
1018 a changelist. |
983 |
1019 |
984 @return list of all items not belonging to a changelist |
1020 @return list of all items not belonging to a changelist |
985 """ |
1021 """ |
986 clitems = [] |
1022 clitems = [] |
987 for itm in self.statusList.selectedItems(): |
1023 for itm in self.statusList.selectedItems(): |
988 if not itm.text(self.__changelistColumn): |
1024 if not itm.text(self.__changelistColumn): |
989 clitems.append(itm) |
1025 clitems.append(itm) |
990 return clitems |
1026 return clitems |
991 |
1027 |
992 def __commitSelect(self, selected): |
1028 def __commitSelect(self, selected): |
993 """ |
1029 """ |
994 Private slot to select or deselect all entries. |
1030 Private slot to select or deselect all entries. |
995 |
1031 |
996 @param selected commit selection state to be set (boolean) |
1032 @param selected commit selection state to be set (boolean) |
997 """ |
1033 """ |
998 for index in range(self.statusList.topLevelItemCount()): |
1034 for index in range(self.statusList.topLevelItemCount()): |
999 itm = self.statusList.topLevelItem(index) |
1035 itm = self.statusList.topLevelItem(index) |
1000 if ( |
1036 if ( |
1001 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable == |
1037 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable |
1002 Qt.ItemFlag.ItemIsUserCheckable |
1038 == Qt.ItemFlag.ItemIsUserCheckable |
1003 ): |
1039 ): |
1004 if selected: |
1040 if selected: |
1005 itm.setCheckState( |
1041 itm.setCheckState(self.__toBeCommittedColumn, Qt.CheckState.Checked) |
1006 self.__toBeCommittedColumn, Qt.CheckState.Checked) |
|
1007 else: |
1042 else: |
1008 itm.setCheckState( |
1043 itm.setCheckState( |
1009 self.__toBeCommittedColumn, Qt.CheckState.Unchecked) |
1044 self.__toBeCommittedColumn, Qt.CheckState.Unchecked |
|
1045 ) |