Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.9.3, and 2.0

cmdui: rename show_output() to setShowOutput()

Changeset 5c476de947b4

Parent ffd118e1fc4d

by Steve Borho

Changes to 17 files · Browse files at 5c476de947b4 Showing diff from parent ffd118e1fc4d Diff from another changeset...

 
327
328
329
330
 
331
332
 
333
334
335
 
327
328
329
 
330
331
 
332
333
334
335
@@ -327,9 +327,9 @@
    def detail_clicked(self):   if self.cmd.is_show_output(): - self.cmd.show_output(False) + self.cmd.setShowOutput(False)   else: - self.cmd.show_output(True) + self.cmd.setShowOutput(True)     def cancel_clicked():   self.cmd.cancel()
 
171
172
173
174
 
175
176
177
 
171
172
173
 
174
175
176
177
@@ -171,7 +171,7 @@
  self.cmd.cancel()     def detail_toggled(self, checked): - self.cmd.show_output(checked) + self.cmd.setShowOutput(checked)     def command_started(self):   self.cmd.setShown(True)
 
53
54
55
56
 
57
58
59
 
53
54
55
 
56
57
58
59
@@ -53,7 +53,7 @@
    ## command widget   self.cmd = cmdui.Widget() - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   box.addWidget(self.cmd, 1)     hbox = QHBoxLayout()
 
305
306
307
308
 
309
310
311
 
305
306
307
 
308
309
310
311
@@ -305,7 +305,7 @@
  self.reject()     def detail_toggled(self, checked): - self.cmd.show_output(checked) + self.cmd.setShowOutput(checked)     def browse_src(self):   FD = QFileDialog
 
682
683
684
685
 
686
687
688
 
698
699
700
701
 
702
703
704
 
739
740
741
742
 
743
744
745
 
749
750
751
752
 
753
754
755
 
830
831
832
833
 
834
835
836
 
850
851
852
853
 
854
 
682
683
684
 
685
686
687
688
 
698
699
700
 
701
702
703
704
 
739
740
741
 
742
743
744
745
 
749
750
751
 
752
753
754
755
 
830
831
832
 
833
834
835
836
 
850
851
852
 
853
854
@@ -682,7 +682,7 @@
  def cancel(self):   self.core.cancel()   - def show_output(self, visible): + def setShowOutput(self, visible):   if self.internallog:   self.core.output_text.setShown(visible)   @@ -698,7 +698,7 @@
  def onCommandFinished(self, ret):   if ret == -1:   self.makeLogVisible.emit(True) - self.show_output(True) + self.setShowOutput(True)   self.commandFinished.emit(ret)    class Dialog(QDialog): @@ -739,7 +739,7 @@
  self.detailBtn.setAutoDefault(False)   self.detailBtn.setCheckable(True)   self.detailBtn.setChecked(True) - self.detailBtn.toggled.connect(self.show_output) + self.detailBtn.toggled.connect(self.setShowOutput)   vbox.addWidget(buttons)     self.setLayout(vbox) @@ -749,7 +749,7 @@
  # start command   self.core.run(cmdline)   - def show_output(self, visible): + def setShowOutput(self, visible):   """show/hide command output"""   self.core.output_text.setVisible(visible)   self.detailBtn.setChecked(visible) @@ -830,7 +830,7 @@
  def cancel(self):   self.core.cancel()   - def show_output(self, visible=True): + def setShowOutput(self, visible=True):   if not self.internallog:   return   if not hasattr(self, 'dlg'): @@ -850,5 +850,5 @@
  def onCommandFinished(self, ret):   if ret != 0:   self.makeLogVisible.emit(True) - self.show_output() + self.setShowOutput(True)   self.commandFinished.emit(ret)
 
52
53
54
55
 
56
57
58
 
52
53
54
 
55
56
57
58
@@ -52,7 +52,7 @@
    self.cmd = cmdui.Widget()   self.cmd.commandFinished.connect(self.commandFinished) - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   self.showMessage.connect(self.cmd.stbar.showMessage)   self.cmd.stbar.linkActivated.connect(self.linkActivated)   self.layout().addWidget(self.cmd, 2)
 
243
244
245
246
 
247
248
249
 
243
244
245
 
246
247
248
249
@@ -243,7 +243,7 @@
  cmd = cmdui.Dialog(['email'] + cmdargs(opts) + list(map(str, self._revs)),   parent=self)   cmd.setWindowTitle(_('Sending Email')) - cmd.show_output(False) + cmd.setShowOutput(False)   if cmd.exec_():   self._writehistory()   super(EmailDialog, self).accept()
 
118
119
120
121
 
122
123
124
 
118
119
120
 
121
122
123
124
@@ -118,7 +118,7 @@
  ppane = QVBoxLayout()   ppane.addSpacing(4)   self.cmd = cmdui.Widget() - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   self.cmd.commandFinished.connect(self.command_finished)   self.cmd.commandCanceling.connect(self.command_canceling)   ppane.addWidget(self.cmd)
 
338
339
340
341
 
342
343
344
 
338
339
340
 
341
342
343
344
@@ -338,7 +338,7 @@
  self.cmd = cmdui.Dialog(['postreview'] + cmdargs(opts) + [revstr],   self, self.onCompletion)   self.cmd.setWindowTitle(_('Posting Review')) - self.cmd.show_output(False) + self.cmd.setShowOutput(False)     @pyqtSlot()   def onCompletion(self):
 
98
99
100
101
 
102
103
104
 
98
99
100
 
101
102
103
104
@@ -98,7 +98,7 @@
  if self.checkResolve() or not (s or d):   for w in (srcb, destb, sep, self.keepchk, self.detachchk):   w.setHidden(True) - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   else:   self.showMessage.emit(_('Checking...'))   QTimer.singleShot(0, self.checkStatus)
 
304
305
306
307
 
308
309
 
310
311
312
 
304
305
306
 
307
308
 
309
310
311
312
@@ -304,9 +304,9 @@
    def detail_clicked(self):   if self.cmd.is_show_output(): - self.cmd.show_output(False) + self.cmd.setShowOutput(False)   else: - self.cmd.show_output(True) + self.cmd.setShowOutput(True)     def cancel_clicked():   self.cmd.cancel()
 
125
126
127
128
 
129
130
131
 
125
126
127
 
128
129
130
131
@@ -125,7 +125,7 @@
  self.layout().addWidget(out)   self.cmd = cmdui.Widget(True, self)   self.cmd.commandFinished.connect(self.refresh) - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   self.layout().addWidget(self.cmd)     BB = QDialogButtonBox
 
37
38
39
40
 
41
42
43
 
62
63
64
65
 
66
67
68
 
37
38
39
 
40
41
42
43
 
62
63
64
 
65
66
67
68
@@ -37,7 +37,7 @@
  self.layout().addWidget(self.allchk)     self.cmd = cmdui.Widget() - self.cmd.show_output(False) + self.cmd.setShowOutput(False)   self.cmd.stbar.setVisible(False)   self.cmd.commandFinished.connect(self.finished)   self.layout().addWidget(self.cmd, 1) @@ -62,7 +62,7 @@
  else:   cmdline = ['revert', '--repository', self.repo.root, self.wfile]   cmdline += ['--rev', self.rev] - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   self.cmd.stbar.setVisible(True)   self.cmd.run(cmdline)  
 
497
498
499
500
 
501
502
503
 
497
498
499
 
500
501
502
503
@@ -497,7 +497,7 @@
  if b: b.setEnabled(False)   self.stopAction.setEnabled(True)   if not self.embedded: - self.cmd.show_output(True) + self.cmd.setShowOutput(True)   self.cmd.setVisible(True)     def commandFinished(self, ret):
 
294
295
296
297
 
298
299
300
 
294
295
296
 
297
298
299
300
@@ -294,7 +294,7 @@
  self.reject()     def detail_toggled(self, checked): - self.cmd.show_output(checked) + self.cmd.setShowOutput(checked)     def command_started(self):   self.cmd.setShown(True)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
 
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
 
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
 # thgstrip.py - MQ strip dialog for TortoiseHg  #  # Copyright 2009 Yuki KODAMA <endflow.net@gmail.com>  # Copyright 2010 David Wilhelm <dave@jumbledpile.com>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    from PyQt4.QtCore import *  from PyQt4.QtGui import *    from mercurial import hg, ui, error    from tortoisehg.util import hglib, paths  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import cmdui, cslist, qtlib, thgrepo    class StripDialog(QDialog):   """Dialog to strip changesets"""     def __init__(self, repo=None, rev=None, parent=None, opts={}):   super(StripDialog, self).__init__(parent)   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)     self.ui = ui.ui()   if repo:   self.repo = repo   else:   root = paths.find_root()   if root:   self.repo = thgrepo.repository(self.ui, path=root)   else:   raise 'not repository'     # base layout box   box = QVBoxLayout()   box.setSpacing(6)     ## main layout grid   self.grid = grid = QGridLayout()   grid.setSpacing(6)   box.addLayout(grid)     ### target revision combo   self.rev_combo = combo = QComboBox()   combo.setEditable(True)   grid.addWidget(QLabel(_('Strip:')), 0, 0)   grid.addWidget(combo, 0, 1)   grid.addWidget(QLabel(_('Preview:')), 1, 0, Qt.AlignLeft | Qt.AlignTop)   self.status = QLabel("")   grid.addWidget(self.status, 1, 1, Qt.AlignLeft | Qt.AlignTop)     if rev is None:   rev = self.repo.dirstate.branch()   else:   rev = str(rev)   combo.addItem(hglib.tounicode(rev))   combo.setCurrentIndex(0)   for name in hglib.getlivebranch(self.repo):   combo.addItem(hglib.tounicode(name))     tags = list(self.repo.tags())   tags.sort()   tags.reverse()   for tag in tags:   combo.addItem(hglib.tounicode(tag))     ### preview box, contained in scroll area, contains preview grid   self.cslist = cslist.ChangesetList()   self.cslistrow = cslistrow = 2   self.cslistcol = cslistcol = 1   grid.addWidget(self.cslist, cslistrow, cslistcol,   Qt.AlignLeft | Qt.AlignTop)     ### options   optbox = QVBoxLayout()   optbox.setSpacing(6)   expander = qtlib.ExpanderLabel(_('Options:'), False)   expander.expanded.connect(self.show_options)   grid.addWidget(expander, 3, 0, Qt.AlignLeft | Qt.AlignTop)   grid.addLayout(optbox, 3, 1)     self.discard_chk = QCheckBox(_('Discard local changes, no backup (-f/--force)'))   self.nobackup_chk = QCheckBox(_('No backup (-n/--nobackup)'))   optbox.addWidget(self.discard_chk)   optbox.addWidget(self.nobackup_chk)     self.discard_chk.setChecked(bool(opts.get('force')))   self.nobackup_chk.setChecked(bool(opts.get('nobackup')))     ## command widget   self.cmd = cmdui.Widget()   self.cmd.commandStarted.connect(self.command_started)   self.cmd.commandFinished.connect(self.command_finished)   self.cmd.commandCanceling.connect(self.command_canceling)   box.addWidget(self.cmd)     ## bottom buttons   buttons = QDialogButtonBox()   self.cancel_btn = buttons.addButton(QDialogButtonBox.Cancel)   self.cancel_btn.clicked.connect(self.cancel_clicked)   self.close_btn = buttons.addButton(QDialogButtonBox.Close)   self.close_btn.clicked.connect(self.reject)   self.close_btn.setAutoDefault(False)   self.strip_btn = buttons.addButton(_('&Strip'),   QDialogButtonBox.ActionRole)   self.strip_btn.clicked.connect(self.strip)   self.detail_btn = buttons.addButton(_('Detail'),   QDialogButtonBox.ResetRole)   self.detail_btn.setAutoDefault(False)   self.detail_btn.setCheckable(True)   self.detail_btn.toggled.connect(self.detail_toggled)   grid.setRowStretch(cslistrow, 1)   grid.setColumnStretch(cslistcol, 1)   box.addWidget(buttons)     # signal handlers   self.rev_combo.editTextChanged.connect(lambda *a: self.preview())   self.rev_combo.lineEdit().returnPressed.connect(self.strip)   self.discard_chk.toggled.connect(lambda *a: self.preview())     # dialog setting   self.setLayout(box)   self.layout().setSizeConstraint(QLayout.SetMinAndMaxSize)   self.setWindowTitle(_('Strip - %s') % self.repo.displayname)   #self.setWindowIcon(qtlib.geticon('strip'))     # prepare to show   self.rev_combo.lineEdit().selectAll()   self.cslist.setHidden(False)   self.cmd.setHidden(True)   self.cancel_btn.setHidden(True)   self.detail_btn.setHidden(True)   self.nobackup_chk.setHidden(True)   self.preview()     ### Private Methods ###     def resizeEvent(self, event):   w = self.grid.cellRect(self.cslistrow, self.cslistcol).width()   h = self.grid.cellRect(self.cslistrow, self.cslistcol).height()   self.cslist.resize(w, h)     def get_rev(self):   """Return the integer revision number of the input or None"""   revstr = hglib.fromunicode(self.rev_combo.currentText())   if not revstr:   return None   try:   rev = self.repo[revstr].rev()   except (error.RepoError, error.LookupError):   return None   return rev     def updatecslist(self, uselimit=True):   """Update the cs list and return the success status as a bool"""   rev = self.get_rev()   if not rev:   return False   striprevs = list(self.repo.changelog.descendants(rev))   striprevs.append(rev)   striprevs.sort()   self.cslist.clear()   self.cslist.update(self.repo, striprevs)   return True     def preview(self):   if self.updatecslist():   striprevs = self.cslist.curitems   cstext = qtlib.markup(_("%s changesets") % len(striprevs),   weight='bold')   self.status.setText(_("%s will be stripped") % cstext)   self.strip_btn.setEnabled(True)   else:   self.cslist.clear()   self.cslist.updatestatus()   cstext = qtlib.markup(_('Unknown revision!'), fg='red',   weight='bold')   self.status.setText(cstext)   self.strip_btn.setDisabled(True)     def strip(self):   cmdline = ['strip', '--repository', self.repo.root, '--verbose']   rev = hglib.fromunicode(self.rev_combo.currentText())   if not rev:   return   cmdline.append(rev)     if self.discard_chk.isChecked():   cmdline.append('--force')   else:   try:   node = self.repo[rev]   except (error.LookupError, error.RepoLookupError, error.RepoError):   return   def isclean():   """return whether WD is changed"""   wc = self.repo[None]   return not (wc.modified() or wc.added() or wc.removed())   if not isclean():   main = _("Detected uncommitted local changes.")   text = _("Do you want to discard them and continue?")   labels = ((QMessageBox.Yes, _('&Yes (--force)')),   (QMessageBox.No, _('&No')))   if qtlib.QuestionMsgBox(_('Confirm Strip'), main, text,   labels=labels, parent=self):   cmdline.append('--force')   else:   return     # backup options   if self.nobackup_chk.isChecked():   cmdline.append('--nobackup')     # start the strip   self.repo.incrementBusyCount()   self.cmd.run(cmdline)     ### Signal Handlers ###     def cancel_clicked(self):   self.cmd.cancel()   self.reject()     def detail_toggled(self, checked): - self.cmd.show_output(checked) + self.cmd.setShowOutput(checked)     def show_options(self, visible):   self.nobackup_chk.setShown(visible)     def command_started(self):   self.cmd.setShown(True)   self.strip_btn.setHidden(True)   self.close_btn.setHidden(True)   self.cancel_btn.setShown(True)   self.detail_btn.setShown(True)     def command_finished(self, ret):   self.repo.decrementBusyCount()   if ret is not 0 or self.cmd.is_show_output():   self.detail_btn.setChecked(True)   self.close_btn.setShown(True)   self.close_btn.setAutoDefault(True)   self.close_btn.setFocus()   self.cancel_btn.setHidden(True)   else:   self.accept()     def command_canceling(self):   self.cancel_btn.setDisabled(True)    def run(ui, *pats, **opts):   rev = None   if opts.get('rev'):   rev = opts.get('rev')   elif len(pats) == 1:   rev = pats[0]   return StripDialog(rev=rev, opts=opts)
 
271
272
273
274
 
275
276
277
 
271
272
273
 
274
275
276
277
@@ -271,7 +271,7 @@
  self.reject()     def detail_toggled(self, checked): - self.cmd.show_output(checked) + self.cmd.setShowOutput(checked)     def show_options(self, visible):   self.merge_chk.setShown(visible)