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

mq: implement qdelete

Changeset bc60b8b46776

Parent 74549f7d052d

by Steve Borho

Changes to one file · Browse files at bc60b8b46776 Showing diff from parent 74549f7d052d Diff from another changeset...

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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
 # mq.py - TortoiseHg MQ widget  #  # Copyright 2011 Steve Borho <steve@borho.org>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2 or any later version.    import os  import re    from PyQt4.QtCore import *  from PyQt4.QtGui import *    from mercurial import hg, ui, url, util, error  from mercurial import merge as mergemod  from hgext import mq as mqmod    from tortoisehg.util import hglib, patchctx  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, cmdui, rejects, commit, shelve, qscilib    class MQWidget(QWidget):   showMessage = pyqtSignal(unicode)   output = pyqtSignal(QString, QString)   progress = pyqtSignal(QString, object, QString, QString, object)   makeLogVisible = pyqtSignal(bool)     def __init__(self, repo, parent, **opts):   QWidget.__init__(self, parent)     self.repo = repo   self.opts = opts   self.refreshing = False     layout = QVBoxLayout()   layout.setSpacing(0)   self.setLayout(layout)     # top toolbar   tbarhbox = QHBoxLayout()   tbarhbox.setSpacing(5)   self.layout().addLayout(tbarhbox, 0)   self.queueCombo = QComboBox()   self.optionsBtn = QPushButton(_('Options'))   self.msgHistoryCombo = PatchMessageCombo(self)   tbarhbox.addWidget(self.queueCombo)   tbarhbox.addWidget(self.optionsBtn)   tbarhbox.addWidget(self.msgHistoryCombo, 1)     # main area consists of a three-way horizontal splitter   self.splitter = splitter = QSplitter()   self.layout().addWidget(splitter, 1)   splitter.setOrientation(Qt.Horizontal)   splitter.setChildrenCollapsible(True)   splitter.setObjectName('splitter')     self.queueFrame = QFrame(splitter)   self.messageFrame = QFrame(splitter)   self.fileListFrame = QFrame(splitter)     # Patch Queue Frame   layout = QVBoxLayout()   layout.setContentsMargins(0, 0, 0, 0)   self.queueFrame.setLayout(layout)     qtbarhbox = QHBoxLayout()   qtbarhbox.setSpacing(2)   layout.addLayout(qtbarhbox, 0)   qtbarhbox.setContentsMargins(0, 0, 0, 0)   self.qpushAllBtn = tb = QToolButton()   #tb.setIcon(qtlib.geticon('qpush'))   tb.setToolTip(_('Apply all patches'))   self.qpushBtn = tb = QToolButton()   tb.setIcon(qtlib.geticon('qpush'))   tb.setToolTip(_('Apply one patch'))   self.setGuardsBtn = tb = QToolButton()   #tb.setIcon(qtlib.geticon('qpush'))   tb.setToolTip(_('Configure guards for selected patch'))   self.qpushMoveBtn = tb = QToolButton()   #tb.setIcon(qtlib.geticon('qpush'))   tb.setToolTip(_('Apply selected patch next (change queue order)'))   self.qdeleteBtn = tb = QToolButton()   tb.setIcon(qtlib.geticon('filedelete'))   tb.setToolTip(_('Delete selected patches'))   self.qpopBtn = tb = QToolButton()   tb.setIcon(qtlib.geticon('qpop'))   tb.setToolTip(_('Unapply one patch'))   self.qpopAllBtn = tb = QToolButton()   #tb.setIcon(qtlib.geticon('qpop'))   tb.setToolTip(_('Unapply all patches'))   qtbarhbox.addWidget(self.qpushAllBtn)   qtbarhbox.addWidget(self.qpushBtn)   qtbarhbox.addStretch(1)   qtbarhbox.addWidget(self.setGuardsBtn)   qtbarhbox.addWidget(self.qpushMoveBtn)   qtbarhbox.addWidget(self.qdeleteBtn)   qtbarhbox.addStretch(1)   qtbarhbox.addWidget(self.qpopBtn)   qtbarhbox.addWidget(self.qpopAllBtn)     self.queueListWidget = QListWidget(self)   layout.addWidget(self.queueListWidget, 1)     self.guardSelBtn = QPushButton()   layout.addWidget(self.guardSelBtn, 0)     self.revisionOrCommitBtn = QPushButton()   layout.addWidget(self.revisionOrCommitBtn, 0)     # Message Frame   layout = QVBoxLayout()   layout.setContentsMargins(0, 0, 0, 0)   self.messageFrame.setLayout(layout)     mtbarhbox = QHBoxLayout()   mtbarhbox.setSpacing(5)   layout.addLayout(mtbarhbox, 0)   mtbarhbox.setContentsMargins(0, 0, 0, 0)   self.newCheckBox = QCheckBox(_('New Patch'))   self.patchNameLE = QLineEdit()   mtbarhbox.addWidget(self.newCheckBox)   mtbarhbox.addWidget(self.patchNameLE, 1)     self.messageEditor = commit.MessageEntry(self)   self.messageEditor.installEventFilter(qscilib.KeyPressInterceptor(self))   self.messageEditor.refresh(repo)   layout.addWidget(self.messageEditor, 1)     qrefhbox = QHBoxLayout()   layout.addLayout(qrefhbox, 0)   qrefhbox.setContentsMargins(0, 0, 0, 0)   self.shelveBtn = QPushButton(_('Shelve'))   self.qnewOrRefreshBtn = QPushButton(_('QRefresh'))   qrefhbox.addStretch(1)   qrefhbox.addWidget(self.shelveBtn)   qrefhbox.addWidget(self.qnewOrRefreshBtn)     # File List Frame   layout = QVBoxLayout()   layout.setContentsMargins(0, 0, 0, 0)   self.fileListFrame.setLayout(layout)     self.fileListWidget = QListWidget(self)   layout.addWidget(self.fileListWidget, 0)     # Command runner and connections...   self.cmd = cmdui.Runner(_('Patch Queue'), parent != None, self)   self.cmd.output.connect(self.output)   self.cmd.makeLogVisible.connect(self.makeLogVisible)   self.cmd.progress.connect(self.progress)   self.cmd.commandFinished.connect(self.onCommandFinished)     self.shelveBtn.clicked.connect(self.launchShelveTool)   self.optionsBtn.clicked.connect(self.launchOptionsDialog)   self.revisionOrCommitBtn.clicked.connect(self.qinitOrCommit)   self.msgHistoryCombo.activated.connect(self.onMessageSelected)   self.queueListWidget.currentRowChanged.connect(self.onPatchSelected)   self.queueListWidget.itemActivated.connect(self.onGotoPatch)   self.queueListWidget.itemChanged.connect(self.onRenamePatch)   self.qpushAllBtn.clicked.connect(self.onPushAll)   self.qpushBtn.clicked.connect(self.onPush)   self.qpopAllBtn.clicked.connect(self.onPopAll)   self.qpopBtn.clicked.connect(self.onPop) + self.qdeleteBtn.clicked.connect(self.onDelete)     self.repo.configChanged.connect(self.onConfigChanged)   self.repo.repositoryChanged.connect(self.onRepositoryChanged)   self.setAcceptDrops(True)     if hasattr(self.patchNameLE, 'setPlaceholderText'): # Qt >= 4.7   self.patchNameLE.setPlaceholderText('### patch name ###')     if parent:   self.layout().setContentsMargins(2, 2, 2, 2)   else:   self.layout().setContentsMargins(0, 0, 0, 0)   self.setWindowTitle(_('TortoiseHg Patch Queue'))   self.statusbar = cmdui.ThgStatusBar(self)   self.layout().addWidget(self.statusbar)   self.progress.connect(self.statusbar.progress)   self.showMessage.connect(self.statusbar.showMessage)   QShortcut(QKeySequence.Refresh, self, self.reload)   self.resize(850, 550)     self.loadConfigs()   QTimer.singleShot(0, self.reload)     @pyqtSlot()   def onConfigChanged(self):   'Repository is reporting its config files have changed'   self.messageEditor.refresh(self.repo)     @pyqtSlot()   def onRepositoryChanged(self):   'Repository is reporting its changelog has changed'   self.reload()     @pyqtSlot(int)   def onCommandFinished(self, ret):   self.repo.decrementBusyCount()   if ret is not 0:   pass # TODO: look for reject notifications   self.reload() # TODO: probably redundant     @pyqtSlot()   def onPushAll(self):   self.repo.incrementBusyCount()   self.cmd.run(['qpush', '-R', self.repo.root, '--all'])     @pyqtSlot()   def onPush(self):   self.repo.incrementBusyCount()   self.cmd.run(['qpush', '-R', self.repo.root])     @pyqtSlot()   def onPopAll(self):   self.repo.incrementBusyCount()   self.cmd.run(['qpop', '-R', self.repo.root, '--all'])     @pyqtSlot()   def onPop(self):   self.repo.incrementBusyCount()   self.cmd.run(['qpop', '-R', self.repo.root])   + @pyqtSlot() + def onDelete(self): + from tortoisehg.hgqt import qdelete + patch = self.queueListWidget.currentItem()._thgpatch + dlg = qdelete.QDeleteDialog(self.repo, [patch], self) + dlg.finished.connect(dlg.deleteLater) + if dlg.exec_() == QDialog.Accepted: + self.reload() +   @pyqtSlot(QListWidgetItem)   def onGotoPatch(self, item):   'Patch has been activated (return), issue qgoto'   self.repo.incrementBusyCount()   self.cmd.run(['qgoto', '-R', self.repo.root, item._thgpatch])     @pyqtSlot(QListWidgetItem)   def onRenamePatch(self, item):   'Patch has been renamed, issue qrename'   self.repo.incrementBusyCount()   self.cmd.run(['qrename', '-R', self.repo.root, item._thgpatch,   hglib.fromunicode(item.text())])     @pyqtSlot(int)   def onPatchSelected(self, row):   'Patch has been selected, update buttons'   if self.refreshing:   return   if row >= 0:   patch = self.queueListWidget.item(row)._thgpatch   applied = set([p.name for p in self.repo.mq.applied]) - self.qdeleteBtn.setEnabled(True) + self.qdeleteBtn.setEnabled(patch not in applied)   self.qpushMoveBtn.setEnabled(patch not in applied)   self.setGuardsBtn.setEnabled(True)   else:   self.qdeleteBtn.setEnabled(False)   self.qpushMoveBtn.setEnabled(False)   self.setGuardsBtn.setEnabled(False)     @pyqtSlot(int)   def onMessageSelected(self, row):   if self.messageEditor.text() and self.messageEditor.isModified():   d = QMessageBox.question(self, _('Confirm Discard Message'),   _('Discard current commit message?'),   QMessageBox.Ok | QMessageBox.Cancel)   if d != QMessageBox.Ok:   return   self.messageEditor.setText(self.messages[row][1])   lines = self.messageEditor.lines()   if lines:   lines -= 1   pos = self.messageEditor.lineLength(lines)   self.messageEditor.setCursorPosition(lines, pos)   self.messageEditor.ensureLineVisible(lines)   hs = self.messageEditor.horizontalScrollBar()   hs.setSliderPosition(0)   self.messageEditor.setModified(False)   self.messageEditor.setFocus()     @pyqtSlot()   def qinitOrCommit(self):   if os.path.isdir(self.repo.mq.join('.hg')):   dlg = commit.CommitDialog([], dict(root=self.repo.mq.path), self)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()   self.reload()   else:   self.repo.incrementBusyCount()   self.cmd.run(['qinit', '-c', '-R', self.repo.root])     @pyqtSlot()   def launchShelveTool(self):   dlg = shelve.ShelveDialog(self.repo, self)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()   self.reload()     @pyqtSlot()   def launchOptionsDialog(self):   dlg = OptionsDialog(self)   dlg.finished.connect(dlg.deleteLater)   dlg.setWindowFlags(Qt.Sheet)   dlg.setWindowModality(Qt.WindowModal)   if dlg.exec_() == QDialog.Accepted:   self.opts.update(dlg.outopts)     def reload(self):   self.refreshing = True   try:   try:   self._reload()   except Exception, e:   self.showMessage.emit(hglib.tounicode(str(e)))   finally:   self.refreshing = False     def _reload(self):   ui, repo = self.repo.ui, self.repo     self.queueCombo.clear()   self.queueListWidget.clear()   self.fileListWidget.clear()     ui.pushbuffer()   mqmod.qqueue(ui, repo, list=True)   out = ui.popbuffer()   activestr = ' (active)' # TODO: not locale safe   for i, qname in enumerate(out.splitlines()):   if qname.endswith(activestr):   current = i   qname = qname[:-len(activestr)]   self.queueCombo.addItem(hglib.tounicode(qname))   self.queueCombo.setCurrentIndex(current)     # TODO: maintain current selection   applied = set([p.name for p in repo.mq.applied])   self.allguards = set()   items = []   for idx, patch in enumerate(repo.mq.series):   item = QListWidgetItem(hglib.tounicode(patch))   if patch in applied: # applied   f = item.font()   f.setBold(True)   item.setFont(f)   elif not repo.mq.pushable(idx)[0]: # guarded   f = item.font()   f.setItalic(True)   item.setFont(f)   patchguards = repo.mq.series_guards[idx]   if patchguards:   for guard in patchguards:   self.allguards.add(guard[1:])   uguards = hglib.tounicode(', '.join(patchguards))   else:   uguards = _('no guards')   uname = hglib.tounicode(patch)   item._thgpatch = patch   item.setToolTip(u'%s: %s' % (uname, uguards))   item.setFlags(Qt.ItemIsSelectable |   Qt.ItemIsEditable |   Qt.ItemIsEnabled)   items.append(item)   for item in reversed(items):   self.queueListWidget.addItem(item)     for guard in repo.mq.active_guards:   self.allguards.add(guard)   self.refreshSelectedGuards()     self.messages = []   for patch in repo.mq.series:   ctx = repo.changectx(patch)   msg = ctx.description()   if msg:   self.messages.append((patch, msg))   self.msgHistoryCombo.reset(self.messages)     if os.path.isdir(self.repo.mq.join('.hg')):   self.revisionOrCommitBtn.setText(_('Commit Queue'))   else:   self.revisionOrCommitBtn.setText(_('Revision Queue'))     self.qpushAllBtn.setEnabled(bool(repo.thgmqunappliedpatches))   self.qpushBtn.setEnabled(bool(repo.thgmqunappliedpatches))   self.qpushMoveBtn.setEnabled(False)   self.qdeleteBtn.setEnabled(False)   self.setGuardsBtn.setEnabled(False)   self.qpopBtn.setEnabled(bool(applied))   self.qpopAllBtn.setEnabled(bool(applied))     # refresh self.messageEditor with qtip description, if not new   # set self.patchNameLE to qtip patch name, if not new   # refresh self.qnewOrRefreshBtn   # refresh self.fileListWidget     def refreshSelectedGuards(self):   total = len(self.allguards)   count = len(self.repo.mq.active_guards)   oldmenu = self.guardSelBtn.menu()   if oldmenu:   oldmenu.setParent(None)   menu = QMenu(self)   for guard in self.allguards:   a = menu.addAction(hglib.tounicode(guard))   a.setCheckable(True)   a.setChecked(guard in self.repo.mq.active_guards)   a.triggered.connect(self.onGuardSelectionChange)   self.guardSelBtn.setMenu(menu)   self.guardSelBtn.setText(_('Guards: %d/%d') % (count, total))     def onGuardSelectionChange(self, isChecked):   guard = hglib.fromunicode(self.sender().text())   newguards = self.repo.mq.active_guards[:]   if isChecked:   newguards.append(guard)   elif guard in newguards:   newguards.remove(guard)   cmdline = ['qselect', '-R', self.repo.root]   cmdline += newguards or ['--none']   self.cmd.run(cmdline)     # Capture drop events, try to import into current patch queue     def dragEnterEvent(self, event):   event.acceptProposedAction()     def dragMoveEvent(self, event):   event.acceptProposedAction()     def dropEvent(self, event):   paths = [unicode(u.toLocalFile()) for u in event.mimeData().urls()]   filepaths = [p for p in paths if os.path.isfile(p)]   if filepaths:   event.setDropAction(Qt.CopyAction)   event.accept()   else:   super(MQWidget, self).dropEvent(event)   return   dlg = thgimport.ImportDialog(repo=self.repo, parent=self)   # TODO: send flag to dialog indicating this is a qimport (alias?)   dlg.finished.connect(dlg.deleteLater)   dlg.setfilepaths(filepaths)   dlg.exec_()     # End drop events     def loadConfigs(self):   'Load history, etc, from QSettings instance'   s = QSettings()   self.splitter.restoreState(s.value('mq/splitter').toByteArray())   userhist = s.value('commit/userhist').toStringList()   self.opts['userhist'] = [hglib.fromunicode(u) for u in userhist if u]   if not self.parent():   self.restoreGeometry(s.value('mq/geom').toByteArray())     def storeConfigs(self):   'Save history, etc, in QSettings instance'   s = QSettings()   s.setValue('mq/splitter', self.splitter.saveState())   if not self.parent():   s.setValue('mq/geom', self.saveGeometry())     def canExit(self):   self.storeConfigs()   return not self.cmd.core.running()     def keyPressEvent(self, event):   if event.key() == Qt.Key_Escape:   if self.cmd.core.running():   self.cmd.cancel()   elif not self.parent() and self.canExit():   self.close()   else:   return super(MQWidget, self).keyPressEvent(event)        class PatchMessageCombo(QComboBox):   def __init__(self, parent):   super(PatchMessageCombo, self).__init__(parent)   self.reset([])     def reset(self, msglist):   self.clear()   self.addItem(_('Patch commit messages...'))   self.loaded = False   self.msglist = msglist     def showPopup(self):   if not self.loaded and self.msglist:   self.clear()   for patch, message in self.msglist:   sum = message.split('\n', 1)[0][:70]   self.addItem(hglib.tounicode('%s: %s' % (patch, sum)))   self.loaded = True   if self.loaded:   super(PatchMessageCombo, self).showPopup()        class OptionsDialog(QDialog):   'Utility dialog for configuring uncommon options'   def __init__(self, parent):   QDialog.__init__(self, parent)   self.setWindowTitle('MQ options')     layout = QFormLayout()   self.setLayout(layout)     self.gitcb = QCheckBox(_('Use git extended diff format'))   layout.addRow(self.gitcb, None)     self.forcecb = QCheckBox(_('Force push or pop'))   layout.addRow(self.forcecb, None)     self.exactcb = QCheckBox(_('Apply patch to its recorded parent'))   layout.addRow(self.exactcb, None)     self.currentdatecb = QCheckBox(_('Update date field with current date'))   layout.addRow(self.currentdatecb, None)     self.datele = QLineEdit()   layout.addRow(QLabel(_('Specify an explicit date:')), self.datele)     self.currentusercb = QCheckBox(_('Update author field with current user'))   layout.addRow(self.currentusercb, None)     self.userle = QLineEdit()   layout.addRow(QLabel(_('Specify an explicit author:')), self.userle)     self.currentdatecb.toggled.connect(self.datele.setDisabled)   self.currentusercb.toggled.connect(self.userle.setDisabled)     self.gitcb.setChecked(parent.opts.get('git', False))   self.forcecb.setChecked(parent.opts.get('force', False))   self.exactcb.setChecked(parent.opts.get('exact', False))   self.currentdatecb.setChecked(parent.opts.get('currentdate', False))   self.currentusercb.setChecked(parent.opts.get('currentuser', False))   self.datele.setText(hglib.tounicode(parent.opts.get('date', '')))   self.userle.setText(hglib.tounicode(parent.opts.get('user', '')))     BB = QDialogButtonBox   bb = QDialogButtonBox(BB.Ok|BB.Cancel)   bb.accepted.connect(self.accept)   bb.rejected.connect(self.reject)   self.bb = bb   layout.addWidget(bb)     def accept(self):   outopts = {}   outopts['git'] = self.gitcb.isChecked()   outopts['force'] = self.forcecb.isChecked()   outopts['exact'] = self.exactcb.isChecked()   outopts['currentdate'] = self.currentdatecb.isChecked()   outopts['currentuser'] = self.currentusercb.isChecked()   if self.currentdatecb.isChecked():   outopts['date'] = ''   else:   outopts['date'] = hglib.fromunicode(self.datele.text())   if self.currentusercb.isChecked():   outopts['user'] = ''   else:   outopts['user'] = hglib.fromunicode(self.userle.text())     self.outopts = outopts   QDialog.accept(self)    def run(ui, *pats, **opts):   from tortoisehg.util import paths   from tortoisehg.hgqt import thgrepo   repo = thgrepo.repository(ui, path=paths.find_root())   return MQWidget(repo, None, **opts)