13 |
13 |
14 import pysvn |
14 import pysvn |
15 |
15 |
16 from PyQt5.QtCore import QMutexLocker, Qt, pyqtSlot |
16 from PyQt5.QtCore import QMutexLocker, Qt, pyqtSlot |
17 from PyQt5.QtGui import QCursor |
17 from PyQt5.QtGui import QCursor |
18 from PyQt5.QtWidgets import QWidget, QHeaderView, QApplication, QMenu, \ |
18 from PyQt5.QtWidgets import ( |
19 QDialogButtonBox, QTreeWidgetItem |
19 QWidget, QHeaderView, QApplication, QMenu, QDialogButtonBox, |
|
20 QTreeWidgetItem |
|
21 ) |
20 |
22 |
21 from E5Gui.E5Application import e5App |
23 from E5Gui.E5Application import e5App |
22 from E5Gui import E5MessageBox |
24 from E5Gui import E5MessageBox |
23 |
25 |
24 from .SvnConst import svnStatusMap |
26 from .SvnConst import svnStatusMap |
56 self.__lockinfoColumn = 7 |
58 self.__lockinfoColumn = 7 |
57 self.__upToDateColumn = 8 |
59 self.__upToDateColumn = 8 |
58 self.__pathColumn = 12 |
60 self.__pathColumn = 12 |
59 self.__lastColumn = self.statusList.columnCount() |
61 self.__lastColumn = self.statusList.columnCount() |
60 |
62 |
61 self.refreshButton = \ |
63 self.refreshButton = self.buttonBox.addButton( |
62 self.buttonBox.addButton(self.tr("Refresh"), |
64 self.tr("Refresh"), QDialogButtonBox.ActionRole) |
63 QDialogButtonBox.ActionRole) |
|
64 self.refreshButton.setToolTip( |
65 self.refreshButton.setToolTip( |
65 self.tr("Press to refresh the status display")) |
66 self.tr("Press to refresh the status display")) |
66 self.refreshButton.setEnabled(False) |
67 self.refreshButton.setEnabled(False) |
67 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
68 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
68 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
69 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
238 itm.setTextAlignment(9, Qt.AlignRight) |
238 itm.setTextAlignment(9, Qt.AlignRight) |
239 itm.setTextAlignment(10, Qt.AlignRight) |
239 itm.setTextAlignment(10, Qt.AlignRight) |
240 itm.setTextAlignment(11, Qt.AlignLeft) |
240 itm.setTextAlignment(11, Qt.AlignLeft) |
241 itm.setTextAlignment(12, Qt.AlignLeft) |
241 itm.setTextAlignment(12, Qt.AlignLeft) |
242 |
242 |
243 if status in [pysvn.wc_status_kind.added, |
243 if ( |
244 pysvn.wc_status_kind.deleted, |
244 status in [pysvn.wc_status_kind.added, |
245 pysvn.wc_status_kind.modified] or \ |
245 pysvn.wc_status_kind.deleted, |
246 propStatus in [pysvn.wc_status_kind.added, |
246 pysvn.wc_status_kind.modified] or |
247 pysvn.wc_status_kind.deleted, |
247 propStatus in [pysvn.wc_status_kind.added, |
248 pysvn.wc_status_kind.modified]: |
248 pysvn.wc_status_kind.deleted, |
|
249 pysvn.wc_status_kind.modified] |
|
250 ): |
249 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
251 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
250 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
252 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
251 else: |
253 else: |
252 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
254 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
253 |
255 |
324 depth = pysvn.depth.immediate |
326 depth = pysvn.depth.immediate |
325 changelists = self.client.get_changelist(name, depth=depth) |
327 changelists = self.client.get_changelist(name, depth=depth) |
326 for fpath, changelist in changelists: |
328 for fpath, changelist in changelists: |
327 fpath = Utilities.normcasepath(fpath) |
329 fpath = Utilities.normcasepath(fpath) |
328 changelistsDict[fpath] = changelist |
330 changelistsDict[fpath] = changelist |
329 hideChangelistColumn = hideChangelistColumn and \ |
331 hideChangelistColumn = ( |
330 len(changelistsDict) == 0 |
332 hideChangelistColumn and len(changelistsDict) == 0 |
|
333 ) |
331 |
334 |
332 # step 2: determine status of files |
335 # step 2: determine status of files |
333 allFiles = self.client.status(name, recurse=recurse, |
336 allFiles = self.client.status(name, recurse=recurse, |
334 get_all=verbose, ignore=True, |
337 get_all=verbose, ignore=True, |
335 update=update) |
338 update=update) |
336 counter = 0 |
339 counter = 0 |
337 for file in allFiles: |
340 for file in allFiles: |
338 uptodate = True |
341 uptodate = True |
339 if file.repos_text_status != pysvn.wc_status_kind.none: |
342 if file.repos_text_status != pysvn.wc_status_kind.none: |
340 uptodate = uptodate and \ |
343 uptodate = ( |
341 file.repos_text_status != \ |
344 uptodate and |
|
345 file.repos_text_status != |
342 pysvn.wc_status_kind.modified |
346 pysvn.wc_status_kind.modified |
|
347 ) |
343 if file.repos_prop_status != pysvn.wc_status_kind.none: |
348 if file.repos_prop_status != pysvn.wc_status_kind.none: |
344 uptodate = uptodate and \ |
349 uptodate = ( |
345 file.repos_prop_status != \ |
350 uptodate and |
|
351 file.repos_prop_status != |
346 pysvn.wc_status_kind.modified |
352 pysvn.wc_status_kind.modified |
|
353 ) |
347 |
354 |
348 lockState = " " |
355 lockState = " " |
349 if file.entry is not None and \ |
356 if ( |
350 hasattr(file.entry, 'lock_token') and \ |
357 file.entry is not None and |
351 file.entry.lock_token is not None: |
358 hasattr(file.entry, 'lock_token') and |
|
359 file.entry.lock_token is not None |
|
360 ): |
352 lockState = "L" |
361 lockState = "L" |
353 if hasattr(file, 'repos_lock') and update: |
362 if hasattr(file, 'repos_lock') and update: |
354 if lockState == "L" and file.repos_lock is None: |
363 if lockState == "L" and file.repos_lock is None: |
355 lockState = "B" |
364 lockState = "B" |
356 elif lockState == " " and file.repos_lock is not None: |
365 elif lockState == " " and file.repos_lock is not None: |
357 lockState = "O" |
366 lockState = "O" |
358 elif lockState == "L" and \ |
367 elif ( |
359 file.repos_lock is not None and \ |
368 lockState == "L" and |
360 file.entry.lock_token != \ |
369 file.repos_lock is not None and |
361 file.repos_lock["token"]: |
370 file.entry.lock_token != |
|
371 file.repos_lock["token"] |
|
372 ): |
362 lockState = "S" |
373 lockState = "S" |
363 |
374 |
364 fpath = Utilities.normcasepath( |
375 fpath = Utilities.normcasepath( |
365 os.path.join(self.dname, file.path)) |
376 os.path.join(self.dname, file.path)) |
366 if fpath in changelistsDict: |
377 if fpath in changelistsDict: |
367 changelist = changelistsDict[fpath] |
378 changelist = changelistsDict[fpath] |
368 else: |
379 else: |
369 changelist = "" |
380 changelist = "" |
370 |
381 |
371 hidePropertyStatusColumn = hidePropertyStatusColumn and \ |
382 hidePropertyStatusColumn = ( |
|
383 hidePropertyStatusColumn and |
372 file.prop_status in [ |
384 file.prop_status in [ |
373 pysvn.wc_status_kind.none, |
385 pysvn.wc_status_kind.none, |
374 pysvn.wc_status_kind.normal |
386 pysvn.wc_status_kind.normal |
375 ] |
387 ] |
376 hideLockColumns = hideLockColumns and \ |
388 ) |
377 not file.is_locked and lockState == " " |
389 hideLockColumns = ( |
|
390 hideLockColumns and |
|
391 not file.is_locked and |
|
392 lockState == " " |
|
393 ) |
378 hideUpToDateColumn = hideUpToDateColumn and uptodate |
394 hideUpToDateColumn = hideUpToDateColumn and uptodate |
379 hideHistoryColumn = hideHistoryColumn and \ |
395 hideHistoryColumn = ( |
|
396 hideHistoryColumn and |
380 not file.is_copied |
397 not file.is_copied |
381 hideSwitchedColumn = hideSwitchedColumn and \ |
398 ) |
|
399 hideSwitchedColumn = ( |
|
400 hideSwitchedColumn and |
382 not file.is_switched |
401 not file.is_switched |
|
402 ) |
383 |
403 |
384 self.__generateItem( |
404 self.__generateItem( |
385 changelist, |
405 changelist, |
386 file.text_status, |
406 file.text_status, |
387 file.prop_status, |
407 file.prop_status, |