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()
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
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
 # backout.py - Backout dialog for TortoiseHg  #  # Copyright 2010 Yuki KODAMA <endflow.net@gmail.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 merge as mergemod    from tortoisehg.util import hglib  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, csinfo, i18n, cmdui, status, resolve    keep = i18n.keepgettext()    class BackoutDialog(QDialog):     def __init__(self, repo, rev='tip', parent=None, opts={}):   super(BackoutDialog, self).__init__(parent)   f = self.windowFlags()   self.setWindowFlags(f & ~Qt.WindowContextHelpButtonHint)   self.repo = repo   self.didbackout = False     # main layout box   box = QVBoxLayout()   box.setSpacing(8)   box.setContentsMargins(*(6,)*4)     ## target revision   target_sep = qtlib.LabeledSeparator(_('Target changeset'))   box.addWidget(target_sep)     style = csinfo.panelstyle(selectable=True)   self.target_info = csinfo.create(self.repo, rev, style, withupdate=True)   box.addWidget(self.target_info)     ## backout message   msg_sep = qtlib.LabeledSeparator(_('Backout commit message'))   box.addWidget(msg_sep)     revhex = self.target_info.get_data('revid')   self.msgset = keep._('Backed out changeset: ')   self.msgset['id'] += revhex   self.msgset['str'] += revhex     self.msg_text = QTextEdit()   self.msg_text.setText(self.msgset['str'])   box.addWidget(self.msg_text, 1)     ## options   opt_sep = qtlib.LabeledSeparator(_('Options'))   box.addWidget(opt_sep)     obox = QVBoxLayout()   obox.setSpacing(3)   box.addLayout(obox)     self.eng_chk = QCheckBox(_('Use English backout message'))   self.eng_chk.toggled.connect(self.eng_toggled)   engmsg = self.repo.ui.configbool('tortoisehg', 'engmsg', False)   self.eng_chk.setChecked(engmsg)     obox.addWidget(self.eng_chk)   self.merge_chk = QCheckBox(_('Commit backout before merging with '   'current working parent'))   self.merge_chk.toggled.connect(self.merge_toggled)   self.msg_text.setEnabled(False)   obox.addWidget(self.merge_chk)     self.autoresolve_chk = QCheckBox(_('Automatically resolve merge conflicts '   'where possible'))   self.autoresolve_chk.setChecked(   repo.ui.configbool('tortoisehg', 'autoresolve', False))   obox.addWidget(self.autoresolve_chk)     self.reslabel = QLabel()   self.reslabel.linkActivated.connect(self.link_activated)   box.addWidget(self.reslabel)     ## 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, 2)     ## 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.backout_btn = buttons.addButton(_('&Backout'),   QDialogButtonBox.ActionRole)   self.backout_btn.clicked.connect(self.backout)   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)   box.addWidget(buttons)     # dialog setting   self.setLayout(box)   self.setMinimumWidth(480)   self.setMaximumHeight(800)   self.resize(0, 340)   self.setWindowTitle(_("Backout '%s' - %s") % (revhex,   self.repo.displayname))     self.merge_chk.setChecked(bool(opts.get('merge')))     # prepare to show   self.cmd.setHidden(True)   self.cancel_btn.setHidden(True)   self.detail_btn.setHidden(True)   self.msg_text.setFocus()   cursor = self.msg_text.textCursor()   cursor.movePosition(QTextCursor.EndOfBlock)   self.msg_text.setTextCursor(cursor)     ### Private Methods ###     def merge_toggled(self, checked):   self.msg_text.setEnabled(checked)     def eng_toggled(self, checked):   msg = self.msg_text.toPlainText()   origmsg = (checked and self.msgset['str'] or self.msgset['id'])   if msg != origmsg:   if not qtlib.QuestionMsgBox(_('Confirm Discard Message'),   _('Discard current backout message?'), parent=self):   self.eng_chk.blockSignals(True)   self.eng_chk.setChecked(not checked)   self.eng_chk.blockSignals(False)   return   newmsg = (checked and self.msgset['id'] or self.msgset['str'])   self.msg_text.setText(newmsg)     def backout(self):   # prepare command line   revhex = self.target_info.get_data('revid')   cmdline = ['backout', '--rev', revhex, '--repository', self.repo.root]   cmdline += ['--tool=internal:' +   (self.autoresolve_chk.isChecked() and 'merge' or 'fail')]   if self.merge_chk.isChecked():   cmdline += ['--merge']   msg = self.msg_text.toPlainText()   cmdline += ['--message', hglib.fromunicode(msg)]     # start backing out   self.cmdline = cmdline   self.repo.incrementBusyCount()   self.cmd.run(cmdline)     def commit(self):   cmdline = ['commit', '--repository', self.repo.root]   msg = self.msg_text.toPlainText()   cmdline += ['--message', hglib.fromunicode(msg)]   self.cmdline = cmdline   self.repo.incrementBusyCount()   self.cmd.run(cmdline)     ### Signal Handlers ###     def cancel_clicked(self):   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)   self.close_btn.setHidden(True)   self.cancel_btn.setShown(True)   self.detail_btn.setShown(True)     def command_canceling(self):   self.cancel_btn.setDisabled(True)     def command_finished(self, ret):   self.repo.decrementBusyCount()   self.cancel_btn.setHidden(True)   if ret not in (0, 1):   self.detail_btn.setChecked(True)   self.close_btn.setShown(True)   self.close_btn.setAutoDefault(True)   self.close_btn.setFocus()   elif self.cmdline[0] == 'backout':   self.didbackout = True   self.merge_chk.setEnabled(False)   self.msg_text.setEnabled(True)   self.backout_btn.setText(_('Commit'))   self.backout_btn.clicked.disconnect(self.backout)   self.backout_btn.clicked.connect(self.commit)   self.checkResolve()   elif not self.cmd.is_show_output():   self.accept()     def checkResolve(self):   ms = mergemod.mergestate(self.repo)   for path in ms:   if ms[path] == 'u':   txt = _('Backout generated merge <b>conflicts</b> that must '   'be <a href="resolve"><b>resolved</b></a>')   self.backout_btn.setEnabled(False)   break   else:   self.backout_btn.setEnabled(True)   txt = _('You may commit the backed out changes after '   '<a href="status"><b>verifying</b></a> them')   self.reslabel.setText(txt)     @pyqtSlot(QString)   def link_activated(self, cmd):   if cmd == 'resolve':   dlg = resolve.ResolveDialog(self.repo, self)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()   self.checkResolve()   elif cmd == 'status':   dlg = status.StatusDialog([], {}, self.repo.root, self)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()   self.checkResolve()    def run(ui, *pats, **opts):   from tortoisehg.util import paths   from tortoisehg.hgqt import thgrepo   repo = thgrepo.repository(ui, path=paths.find_root())   kargs = {'opts': opts}   if opts.get('rev'):   kargs['rev'] = opts.get('rev')   elif len(pats) == 1:   kargs['rev'] = pats[0]   return BackoutDialog(repo, **kargs)
 
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)
 
223
224
225
226
 
227
228
229
 
223
224
225
 
226
227
228
229
@@ -223,7 +223,7 @@
  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)
 
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)