23 from .SvnDiffDialog import SvnDiffDialog |
23 from .SvnDiffDialog import SvnDiffDialog |
24 |
24 |
25 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
25 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
26 |
26 |
27 import Preferences |
27 import Preferences |
|
28 |
28 |
29 |
29 class SvnStatusDialog(QWidget, SvnDialogMixin, Ui_SvnStatusDialog): |
30 class SvnStatusDialog(QWidget, SvnDialogMixin, Ui_SvnStatusDialog): |
30 """ |
31 """ |
31 Class implementing a dialog to show the output of the svn status command |
32 Class implementing a dialog to show the output of the svn status command |
32 process. |
33 process. |
33 """ |
34 """ |
34 def __init__(self, vcs, parent = None): |
35 def __init__(self, vcs, parent=None): |
35 """ |
36 """ |
36 Constructor |
37 Constructor |
37 |
38 |
38 @param vcs reference to the vcs object |
39 @param vcs reference to the vcs object |
39 @param parent parent widget (QWidget) |
40 @param parent parent widget (QWidget) |
53 self.__upToDateColumn = 8 |
54 self.__upToDateColumn = 8 |
54 self.__pathColumn = 12 |
55 self.__pathColumn = 12 |
55 self.__lastColumn = self.statusList.columnCount() |
56 self.__lastColumn = self.statusList.columnCount() |
56 |
57 |
57 self.refreshButton = \ |
58 self.refreshButton = \ |
58 self.buttonBox.addButton(self.trUtf8("Refresh"), |
59 self.buttonBox.addButton(self.trUtf8("Refresh"), |
59 QDialogButtonBox.ActionRole) |
60 QDialogButtonBox.ActionRole) |
60 self.refreshButton.setToolTip( |
61 self.refreshButton.setToolTip( |
61 self.trUtf8("Press to refresh the status display")) |
62 self.trUtf8("Press to refresh the status display")) |
62 self.refreshButton.setEnabled(False) |
63 self.refreshButton.setEnabled(False) |
63 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
64 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
115 self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) |
116 self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) |
116 self.statusList.customContextMenuRequested.connect( |
117 self.statusList.customContextMenuRequested.connect( |
117 self.__showContextMenu) |
118 self.__showContextMenu) |
118 |
119 |
119 self.modifiedIndicators = [ |
120 self.modifiedIndicators = [ |
120 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.added]), |
121 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.added]), |
121 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.deleted]), |
122 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.deleted]), |
122 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.modified]) |
123 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.modified]) |
123 ] |
124 ] |
124 |
125 |
125 self.missingIndicators = [ |
126 self.missingIndicators = [ |
126 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.missing]), |
127 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.missing]), |
127 ] |
128 ] |
128 |
129 |
129 self.unversionedIndicators = [ |
130 self.unversionedIndicators = [ |
130 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.unversioned]), |
131 self.trUtf8(svnStatusMap[pysvn.wc_status_kind.unversioned]), |
131 ] |
132 ] |
132 |
133 |
133 self.lockedIndicators = [ |
134 self.lockedIndicators = [ |
134 self.trUtf8('locked'), |
135 self.trUtf8('locked'), |
135 ] |
136 ] |
136 |
137 |
137 self.stealBreakLockIndicators = [ |
138 self.stealBreakLockIndicators = [ |
138 self.trUtf8('other lock'), |
139 self.trUtf8('other lock'), |
139 self.trUtf8('stolen lock'), |
140 self.trUtf8('stolen lock'), |
140 self.trUtf8('broken lock'), |
141 self.trUtf8('broken lock'), |
141 ] |
142 ] |
142 |
143 |
143 self.unlockedIndicators = [ |
144 self.unlockedIndicators = [ |
144 self.trUtf8('not locked'), |
145 self.trUtf8('not locked'), |
145 ] |
146 ] |
146 |
147 |
147 self.lockinfo = { |
148 self.lockinfo = { |
148 ' ' : self.trUtf8('not locked'), |
149 ' ': self.trUtf8('not locked'), |
149 'L' : self.trUtf8('locked'), |
150 'L': self.trUtf8('locked'), |
150 'O' : self.trUtf8('other lock'), |
151 'O': self.trUtf8('other lock'), |
151 'S' : self.trUtf8('stolen lock'), |
152 'S': self.trUtf8('stolen lock'), |
152 'B' : self.trUtf8('broken lock'), |
153 'B': self.trUtf8('broken lock'), |
153 } |
154 } |
154 self.yesno = [ |
155 self.yesno = [ |
155 self.trUtf8('no'), |
156 self.trUtf8('no'), |
156 self.trUtf8('yes'), |
157 self.trUtf8('yes'), |
157 ] |
158 ] |
158 |
159 |
159 self.client = self.vcs.getClient() |
160 self.client = self.vcs.getClient() |
160 self.client.callback_cancel = \ |
161 self.client.callback_cancel = \ |
161 self._clientCancelCallback |
162 self._clientCancelCallback |
200 @param author author of the last change (string) |
201 @param author author of the last change (string) |
201 @param path path of the file or directory (string) |
202 @param path path of the file or directory (string) |
202 """ |
203 """ |
203 statusText = self.trUtf8(svnStatusMap[status]) |
204 statusText = self.trUtf8(svnStatusMap[status]) |
204 itm = QTreeWidgetItem(self.statusList, [ |
205 itm = QTreeWidgetItem(self.statusList, [ |
205 "", |
206 "", |
206 changelist, |
207 changelist, |
207 statusText, |
208 statusText, |
208 self.trUtf8(svnStatusMap[propStatus]), |
209 self.trUtf8(svnStatusMap[propStatus]), |
209 self.yesno[locked], |
210 self.yesno[locked], |
210 self.yesno[history], |
211 self.yesno[history], |
211 self.yesno[switched], |
212 self.yesno[switched], |
212 self.lockinfo[lockinfo], |
213 self.lockinfo[lockinfo], |
213 self.yesno[uptodate], |
214 self.yesno[uptodate], |
214 "{0:7}".format(str(revision)), |
215 "{0:7}".format(str(revision)), |
215 "{0:7}".format(str(change)), |
216 "{0:7}".format(str(change)), |
216 author, |
217 author, |
217 path, |
218 path, |
218 ]) |
219 ]) |
219 |
220 |
220 itm.setTextAlignment(1, Qt.AlignLeft) |
221 itm.setTextAlignment(1, Qt.AlignLeft) |
221 itm.setTextAlignment(2, Qt.AlignHCenter) |
222 itm.setTextAlignment(2, Qt.AlignHCenter) |
222 itm.setTextAlignment(3, Qt.AlignHCenter) |
223 itm.setTextAlignment(3, Qt.AlignHCenter) |
306 changelistsDict[entry[0]] = entry[1] |
307 changelistsDict[entry[0]] = entry[1] |
307 hideChangelistColumn = hideChangelistColumn and \ |
308 hideChangelistColumn = hideChangelistColumn and \ |
308 len(changelistsDict) == 0 |
309 len(changelistsDict) == 0 |
309 |
310 |
310 # step 2: determine status of files |
311 # step 2: determine status of files |
311 allFiles = self.client.status(name, recurse = recurse, |
312 allFiles = self.client.status(name, recurse=recurse, |
312 get_all=verbose, ignore=True, |
313 get_all=verbose, ignore=True, |
313 update = update) |
314 update=update) |
314 counter = 0 |
315 counter = 0 |
315 for file in allFiles: |
316 for file in allFiles: |
316 uptodate = True |
317 uptodate = True |
317 if file.repos_text_status != pysvn.wc_status_kind.none: |
318 if file.repos_text_status != pysvn.wc_status_kind.none: |
318 uptodate = uptodate and \ |
319 uptodate = uptodate and \ |
341 else: |
342 else: |
342 changelist = "" |
343 changelist = "" |
343 |
344 |
344 hidePropertyStatusColumn = hidePropertyStatusColumn and \ |
345 hidePropertyStatusColumn = hidePropertyStatusColumn and \ |
345 file.prop_status in [ |
346 file.prop_status in [ |
346 pysvn.wc_status_kind.none, |
347 pysvn.wc_status_kind.none, |
347 pysvn.wc_status_kind.normal |
348 pysvn.wc_status_kind.normal |
348 ] |
349 ] |
349 hideLockColumns = hideLockColumns and \ |
350 hideLockColumns = hideLockColumns and \ |
350 not file.is_locked and lockState == " " |
351 not file.is_locked and lockState == " " |
351 hideUpToDateColumn = hideUpToDateColumn and uptodate |
352 hideUpToDateColumn = hideUpToDateColumn and uptodate |
375 if self._clientCancelCallback(): |
376 if self._clientCancelCallback(): |
376 break |
377 break |
377 if self._clientCancelCallback(): |
378 if self._clientCancelCallback(): |
378 break |
379 break |
379 except pysvn.ClientError as e: |
380 except pysvn.ClientError as e: |
380 self.__showError(e.args[0]+'\n') |
381 self.__showError(e.args[0] + '\n') |
381 |
382 |
382 self.statusList.setColumnHidden(self.__propStatusColumn, |
383 self.statusList.setColumnHidden(self.__propStatusColumn, |
383 hidePropertyStatusColumn) |
384 hidePropertyStatusColumn) |
384 self.statusList.setColumnHidden(self.__lockedColumn, |
385 self.statusList.setColumnHidden(self.__lockedColumn, |
385 hideLockColumns) |
386 hideLockColumns) |
698 self.trUtf8("Unlock"), |
699 self.trUtf8("Unlock"), |
699 self.trUtf8("""There are no locked files""" |
700 self.trUtf8("""There are no locked files""" |
700 """ available/selected.""")) |
701 """ available/selected.""")) |
701 return |
702 return |
702 |
703 |
703 self.vcs.svnUnlock(names, parent = self) |
704 self.vcs.svnUnlock(names, parent=self) |
704 self.on_refreshButton_clicked() |
705 self.on_refreshButton_clicked() |
705 |
706 |
706 def __breakLock(self): |
707 def __breakLock(self): |
707 """ |
708 """ |
708 Private slot to handle the Break Lock context menu entry. |
709 Private slot to handle the Break Lock context menu entry. |
715 self.trUtf8("Break Lock"), |
716 self.trUtf8("Break Lock"), |
716 self.trUtf8("""There are no locked files""" |
717 self.trUtf8("""There are no locked files""" |
717 """ available/selected.""")) |
718 """ available/selected.""")) |
718 return |
719 return |
719 |
720 |
720 self.vcs.svnUnlock(names, parent = self, breakIt = True) |
721 self.vcs.svnUnlock(names, parent=self, breakIt=True) |
721 self.on_refreshButton_clicked() |
722 self.on_refreshButton_clicked() |
722 |
723 |
723 def __stealLock(self): |
724 def __stealLock(self): |
724 """ |
725 """ |
725 Private slot to handle the Break Lock context menu entry. |
726 Private slot to handle the Break Lock context menu entry. |