Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph

Merge with stable

Changeset cc9fafc69176

Parents c19873efd8d5

Parents 17025c560486

by Steve Borho

Changes to 12 files · Browse files at cc9fafc69176 Showing diff from parent c19873efd8d5 17025c560486 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
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
 # clone.py - Clone dialog for TortoiseHg  #  # Copyright 2007 TK Soh <teekaysoh@gmail.com>  # Copyright 2007 Steve Borho <steve@borho.org>  # 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.   -import os, string +import os    from PyQt4.QtCore import *  from PyQt4.QtGui import *    from mercurial import ui, cmdutil, commands    from tortoisehg.util import hglib  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import cmdui, qtlib    class CloneDialog(QDialog):     cmdfinished = pyqtSignal(int)   clonedRepository = pyqtSignal(QString)     def __init__(self, args=None, opts={}, parent=None):   super(CloneDialog, self).__init__(parent)   f = self.windowFlags()   self.setWindowFlags(f & ~Qt.WindowContextHelpButtonHint)   self.ui = ui.ui()   self.ret = None     dest = src = cwd = os.getcwd()   if len(args) > 1:   src = args[0]   dest = args[1]   elif len(args):   src = args[0]   udest = hglib.tounicode(dest)   usrc = hglib.tounicode(src)   ucwd = hglib.tounicode(cwd)     self.prev_dest = None     # base layout box   box = QVBoxLayout()   box.setSpacing(6)     ## main layout grid   grid = QGridLayout()   grid.setSpacing(6)   box.addLayout(grid)     ### source combo and button   self.src_combo = QComboBox()   self.src_combo.setEditable(True)   self.src_combo.setMinimumWidth(310) - self.src_combo.lineEdit().returnPressed.connect(self.clone)   self.src_btn = QPushButton(_('Browse...'))   self.src_btn.setAutoDefault(False)   self.src_btn.clicked.connect(self.browse_src)   grid.addWidget(QLabel(_('Source:')), 0, 0)   grid.addWidget(self.src_combo, 0, 1)   grid.addWidget(self.src_btn, 0, 2)     ### destination combo and button   self.dest_combo = QComboBox()   self.dest_combo.setEditable(True)   self.dest_combo.setMinimumWidth(310)   self.dest_btn = QPushButton(_('Browse...'))   self.dest_btn.setAutoDefault(False)   self.dest_btn.clicked.connect(self.browse_dest)   grid.addWidget(QLabel(_('Destination:')), 1, 0)   grid.addWidget(self.dest_combo, 1, 1)   grid.addWidget(self.dest_btn, 1, 2)     # workaround for QComboBox to test edited text case-sensitively   # see src/gui/widgets/qcombobox.cpp:   # QComboBoxPrivate::_q_editingFinished() and matchFlags()   for name in ('src_combo', 'dest_combo'):   w = getattr(self, name).lineEdit()   w.completer().setCaseSensitivity(Qt.CaseSensitive)     s = QSettings()   self.shist = s.value('clone/source').toStringList()   for path in self.shist:   if path: self.src_combo.addItem(path)   self.src_combo.setEditText(usrc)     self.dhist = s.value('clone/dest').toStringList()   for path in self.dhist:   if path: self.dest_combo.addItem(path)   self.dest_combo.setEditText(udest)     ### options   expander = qtlib.ExpanderLabel(_('Options'), False)   expander.expanded.connect(self.show_options)   grid.addWidget(expander, 2, 0, Qt.AlignLeft | Qt.AlignTop)     optbox = QVBoxLayout()   optbox.setSpacing(6)   grid.addLayout(optbox, 2, 1, 1, 2)     def chktext(chklabel, btnlabel=None, btnslot=None, stretch=None):   hbox = QHBoxLayout()   hbox.setSpacing(0)   optbox.addLayout(hbox)   chk = QCheckBox(chklabel)   text = QLineEdit(enabled=False)   hbox.addWidget(chk)   hbox.addWidget(text)   if stretch is not None:   hbox.addStretch(stretch)   if btnlabel:   btn = QPushButton(btnlabel)   btn.setEnabled(False) - btn.setAutoDefault = False + btn.setAutoDefault(False)   btn.clicked.connect(btnslot) + hbox.addSpacing(6)   hbox.addWidget(btn)   chk.toggled.connect(   lambda e: self.toggle_enabled(e, text, target2=btn))   return chk, text, btn   else:   chk.toggled.connect(lambda e: self.toggle_enabled(e, text))   return chk, text     self.rev_chk, self.rev_text = chktext(_('Clone to revision:'),   stretch=40)     self.noupdate_chk = QCheckBox(_('Do not update the new working directory'))   self.pproto_chk = QCheckBox(_('Use pull protocol to copy metadata'))   self.uncomp_chk = QCheckBox(_('Use uncompressed transfer'))   optbox.addWidget(self.noupdate_chk)   optbox.addWidget(self.pproto_chk)   optbox.addWidget(self.uncomp_chk)     self.qclone_chk, self.qclone_txt, self.qclone_btn = \   chktext(_('Include patch queue'), btnlabel=_('Browse...'),   btnslot=self.onBrowseQclone)     self.proxy_chk = QCheckBox(_('Use proxy server'))   optbox.addWidget(self.proxy_chk)   useproxy = bool(self.ui.config('http_proxy', 'host'))   self.proxy_chk.setEnabled(useproxy)   self.proxy_chk.setChecked(useproxy)     self.insecure_chk = QCheckBox(_('Do not verify host certificate'))   optbox.addWidget(self.insecure_chk)   self.insecure_chk.setEnabled(False)     self.remote_chk, self.remote_text = chktext(_('Remote command:'))     # allow to specify start revision for p4 & svn repos.   self.startrev_chk, self.startrev_text = chktext(_('Start revision:'),   stretch=40)     self.hgcmd_lbl = QLabel(_('Hg command:'))   self.hgcmd_lbl.setAlignment(Qt.AlignRight)   self.hgcmd_txt = QLineEdit()   self.hgcmd_txt.setReadOnly(True)   grid.addWidget(self.hgcmd_lbl, 3, 0)   grid.addWidget(self.hgcmd_txt, 3, 1)   self.hgcmd_txt.setMinimumWidth(400)     ## command widget   self.cmd = cmdui.Widget(True, True, self)   self.cmd.commandStarted.connect(self.command_started)   self.cmd.commandFinished.connect(self.command_finished)   self.cmd.commandFinished.connect(self.cmdfinished)   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.cmd.cancel)   self.close_btn = buttons.addButton(QDialogButtonBox.Close)   self.close_btn.clicked.connect(self.onCloseClicked)   self.close_btn.setAutoDefault(False)   self.clone_btn = buttons.addButton(_('&Clone'),   QDialogButtonBox.ActionRole)   self.clone_btn.clicked.connect(self.clone)   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.layout().setSizeConstraint(QLayout.SetFixedSize)   self.setWindowTitle(_('Clone - %s') % ucwd)   self.setWindowIcon(qtlib.geticon('hg-clone'))     # connect extra signals   self.src_combo.editTextChanged.connect(self.composeCommand)   self.src_combo.editTextChanged.connect(self.onUrlHttps) + self.src_combo.editTextChanged.connect(self.onResetDefault) + self.src_combo.currentIndexChanged.connect(self.onResetDefault)   self.dest_combo.editTextChanged.connect(self.composeCommand)   self.rev_chk.toggled.connect(self.composeCommand)   self.rev_text.textChanged.connect(self.composeCommand)   self.noupdate_chk.toggled.connect(self.composeCommand)   self.pproto_chk.toggled.connect(self.composeCommand)   self.uncomp_chk.toggled.connect(self.composeCommand)   self.qclone_chk.toggled.connect(self.composeCommand)   self.qclone_txt.textChanged.connect(self.composeCommand)   self.proxy_chk.toggled.connect(self.composeCommand)   self.insecure_chk.toggled.connect(self.composeCommand)   self.remote_chk.toggled.connect(self.composeCommand)   self.remote_text.textChanged.connect(self.composeCommand)   self.startrev_chk.toggled.connect(self.composeCommand)     # prepare to show   self.cmd.setHidden(True)   self.cancel_btn.setHidden(True)   self.detail_btn.setHidden(True)   self.show_options(False)     rev = opts.get('rev')   if rev:   self.rev_chk.setChecked(True)   self.rev_text.setText(hglib.tounicode(', '.join(rev)))   self.noupdate_chk.setChecked(bool(opts.get('noupdate')))   self.pproto_chk.setChecked(bool(opts.get('pull')))   self.uncomp_chk.setChecked(bool(opts.get('uncompressed')))     self.src_combo.setFocus()   self.src_combo.lineEdit().selectAll()     self.composeCommand()     ### Private Methods ###     def getSrc(self):   return hglib.fromunicode(self.src_combo.currentText()).strip()     def getDest(self):   return hglib.fromunicode(self.dest_combo.currentText()).strip()     def show_options(self, visible):   self.rev_chk.setVisible(visible)   self.rev_text.setVisible(visible)   self.noupdate_chk.setVisible(visible)   self.pproto_chk.setVisible(visible)   self.uncomp_chk.setVisible(visible)   self.proxy_chk.setVisible(visible)   self.insecure_chk.setVisible(visible)   self.qclone_chk.setVisible(visible)   self.qclone_txt.setVisible(visible)   self.qclone_btn.setVisible(visible)   self.remote_chk.setVisible(visible)   self.remote_text.setVisible(visible)   self.startrev_chk.setVisible(visible and self.startrev_available())   self.startrev_text.setVisible(visible and self.startrev_available())     def composeCommand(self):   remotecmd = hglib.fromunicode(self.remote_text.text().trimmed())   rev = hglib.fromunicode(self.rev_text.text().trimmed())   startrev = hglib.fromunicode(self.startrev_text.text().trimmed())   if self.qclone_chk.isChecked():   qclonedir = hglib.fromunicode(self.qclone_txt.text().trimmed())   if qclonedir == '':   qclonedir = '.hg\patches'   self.qclone_txt.setText(qclonedir)   cmdline = ['qclone']   if not qclonedir in ['.hg\patches', '.hg/patches', '']:   cmdline += ['--patches', qclonedir]   else:   cmdline = ['clone']   if self.noupdate_chk.isChecked():   cmdline.append('--noupdate')   if self.uncomp_chk.isChecked():   cmdline.append('--uncompressed')   if self.pproto_chk.isChecked():   cmdline.append('--pull')   if self.ui.config('http_proxy', 'host'):   if not self.proxy_chk.isChecked():   cmdline += ['--config', 'http_proxy.host=']   if self.remote_chk.isChecked() and remotecmd:   cmdline.append('--remotecmd')   cmdline.append(remotecmd)   if self.rev_chk.isChecked() and rev:   cmdline.append('--rev')   cmdline.append(rev)   if self.startrev_chk.isChecked() and startrev:   cmdline.append('--startrev')   cmdline.append(startrev)   cmdline.append('--verbose')   src = self.getSrc()   dest = self.getDest()   if self.insecure_chk.isChecked() and src.startswith('https://'):   cmdline.append('--insecure')   cmdline.append('--')   cmdline.append(src)   if dest:   cmdline.append(dest)   self.hgcmd_txt.setText(hglib.tounicode(' '.join(['hg'] + cmdline)))   return cmdline     def startrev_available(self):   entry = cmdutil.findcmd('clone', commands.table)[1]   longopts = set(e[1] for e in entry[1])   return 'startrev' in longopts     def clone(self):   if self.cmd.core.running():   return   # prepare user input   srcQ = self.src_combo.currentText().trimmed()   src = hglib.fromunicode(srcQ)   destQ = self.dest_combo.currentText().trimmed()   dest = hglib.fromunicode(destQ)   if not dest:   dest = os.path.basename(src)   destQ = QString(hglib.tounicode(dest))     if not dest.startswith('ssh://'):   if not os.path.exists(dest):   try:   os.mkdir(dest)   except EnvironmentError:   qtlib.ErrorMsgBox(_('TortoiseHg Clone'),   _('Error creating destination folder'),   _('Please specify a different path.'))   return False   self.prev_dest = None     if srcQ:   l = list(self.shist)   if srcQ in l:   l.remove(srcQ)   l.insert(0, srcQ)   self.shist = l[:10]   if destQ:   l = list(self.dhist)   if destQ in l:   l.remove(destQ)   l.insert(0, destQ)   self.dhist = l[:10]   s = QSettings()   s.setValue('clone/source', self.shist)   s.setValue('clone/dest', self.dhist)     # verify input   if src == '':   qtlib.ErrorMsgBox(_('TortoiseHg Clone'),   _('Source path is empty'),   _('Please enter a valid source path.'))   self.src_combo.setFocus()   return False     if src == dest:   qtlib.ErrorMsgBox(_('TortoiseHg Clone'),   _('Source and destination are the same'),   _('Please specify different paths.'))   return False     if dest == os.getcwd():   if os.listdir(dest):   # cur dir has files, specify no dest, let hg take   # basename   dest = ''   else:   dest = '.'   else:   abs = os.path.abspath(dest)   dirabs = os.path.dirname(abs)   if dirabs == src:   dest = os.path.join(os.path.dirname(dirabs), dest)     # prepare command line   self.src_combo.setEditText(hglib.tounicode(src))   self.dest_combo.setEditText(hglib.tounicode(dest))   cmdline = self.composeCommand()     # do not make the same clone twice (see #514)   if dest == self.prev_dest and os.path.exists(dest) and self.ret == 0:   qtlib.ErrorMsgBox(_('TortoiseHg Clone'),   _('Please enter a new destination path.'))   self.dest_combo.setFocus()   return   self.prev_dest = dest     # start cloning   self.cmd.run(cmdline, useproc=src.startswith('p4://'))     ### Signal Handlers ###     def toggle_enabled(self, checked, target, target2=None):   target.setEnabled(checked)   if checked:   target.setFocus()   if target2:   target2.setEnabled(checked)   self.composeCommand()     def detail_toggled(self, checked):   self.cmd.setShowOutput(checked)     def browse_src(self):   FD = QFileDialog   caption = _("Select source repository")   path = FD.getExistingDirectory(self, caption, \   self.src_combo.currentText(), QFileDialog.ShowDirsOnly)   if path:   self.src_combo.setEditText(QDir.toNativeSeparators(path))   self.dest_combo.setFocus()   self.composeCommand()     def browse_dest(self):   FD = QFileDialog   caption = _("Select destination repository")   path = FD.getExistingDirectory(self, caption, \   self.dest_combo.currentText(), QFileDialog.ShowDirsOnly)   if path:   self.dest_combo.setEditText(QDir.toNativeSeparators(path))   self.dest_combo.setFocus()   self.composeCommand()     def onBrowseQclone(self):   FD = QFileDialog   caption = _("Select patch folder")   upath = FD.getExistingDirectory(self, caption, \   self.qclone_txt.text(), QFileDialog.ShowDirsOnly)   if upath:   path = hglib.fromunicode(upath).replace('/', os.sep)   src = hglib.fromunicode(self.src_combo.currentText())   if not path.startswith(src):   qtlib.ErrorMsgBox('TortoiseHg QClone',   _('The selected patch folder is not'   ' under the source repository.'),   '<p>src = %s</p><p>path = %s</p>' % (src, path))   return   path = path.replace(src + os.sep, '')   self.qclone_txt.setText(QDir.toNativeSeparators(hglib.tounicode(path)))   self.qclone_txt.setFocus()   self.composeCommand()   + @pyqtSlot(QString) + def onResetDefault(self, text): + self.clone_btn.setDefault(True) +   def command_started(self):   self.cmd.setShown(True)   self.clone_btn.setHidden(True)   self.close_btn.setHidden(True)   self.cancel_btn.setEnabled(True)   self.cancel_btn.setShown(True)   self.detail_btn.setShown(True)   self.setChoicesActive(False)     def command_finished(self, ret):   self.ret = ret   if ret is not 0 or self.cmd.outputShown():   self.detail_btn.setChecked(True)   self.clone_btn.setShown(True)   self.close_btn.setShown(True) - self.close_btn.setAutoDefault(True) + self.close_btn.setDefault(True)   self.close_btn.setFocus()   self.cancel_btn.setHidden(True)   else:   self.accept()   self.setChoicesActive(True)     if not ret:   # Let the workbench know that a repository has been successfully   # cloned   self.clonedRepository.emit(self.dest_combo.currentText())     def onCloseClicked(self):   if self.ret is 0:   self.accept()   else:   self.reject()     def onUrlHttps(self):   self.insecure_chk.setEnabled(self.getSrc().startswith('https://'))   self.composeCommand()     def command_canceling(self):   self.cancel_btn.setDisabled(True)     def setChoicesActive(self, mode):   if mode:   self.src_combo.setEnabled(True)   self.src_btn.setEnabled(True)   self.dest_combo.setEnabled(True)   self.dest_btn.setEnabled(True)   self.rev_chk.setEnabled(True)   self.rev_text.setEnabled(self.rev_chk.isChecked())   self.noupdate_chk.setEnabled(True)   self.pproto_chk.setEnabled(True)   self.uncomp_chk.setEnabled(True)   self.qclone_chk.setEnabled(True)   self.qclone_txt.setEnabled(self.qclone_chk.isChecked())   self.qclone_btn.setEnabled(self.qclone_chk.isChecked())   self.proxy_chk.setEnabled(True)   self.insecure_chk.setEnabled(True)   self.remote_chk.setEnabled(True)   self.remote_text.setEnabled(self.remote_chk.isChecked())   self.startrev_chk.setEnabled(True)   self.startrev_text.setEnabled(self.startrev_chk.isChecked())   else:   self.src_combo.setDisabled(True)   self.src_btn.setDisabled(True)   self.dest_combo.setDisabled(True)   self.dest_btn.setDisabled(True)   self.rev_chk.setDisabled(True)   self.rev_text.setDisabled(True)   self.noupdate_chk.setDisabled(True)   self.pproto_chk.setDisabled(True)   self.uncomp_chk.setDisabled(True)   self.qclone_chk.setDisabled(True)   self.qclone_txt.setDisabled(True)   self.qclone_btn.setDisabled(True)   self.proxy_chk.setDisabled(True)   self.insecure_chk.setDisabled(True)   self.remote_chk.setDisabled(True)   self.remote_text.setDisabled(True)   self.startrev_chk.setDisabled(True)   self.startrev_text.setDisabled(True)    def run(ui, *pats, **opts):   return CloneDialog(pats, opts)
 
512
513
514
 
515
516
517
 
566
567
568
569
 
 
570
571
572
 
626
627
628
 
629
630
631
 
512
513
514
515
516
517
518
 
567
568
569
 
570
571
572
573
574
 
628
629
630
631
632
633
634
@@ -512,6 +512,7 @@
  self.setFocusProxy(self._logwidget)   self.setRepository(None)   self.openPrompt() + self.suppressPrompt = False     def _initlogwidget(self):   self._logwidget = _LogWidgetForConsole(self) @@ -566,7 +567,8 @@
  try:   self._logwidget.appendLog(msg, label)   finally: - self.openPrompt() + if not self.suppressPrompt: + self.openPrompt()     @pyqtSlot(object)   def setRepository(self, repo): @@ -626,6 +628,7 @@
    @_cmdtable   def _cmd_hg(self, args): + self.closePrompt()   if self._repo:   args = ['--cwd', self._repo.root] + args   self._cmdcore.run(args)
 
38
39
40
 
 
41
42
43
 
70
71
72
 
 
73
74
75
 
38
39
40
41
42
43
44
45
 
72
73
74
75
76
77
78
79
@@ -38,6 +38,8 @@
  progress = pyqtSignal(QString, object, QString, QString, object)   output = pyqtSignal(QString, QString)   makeLogVisible = pyqtSignal(bool) + beginSuppressPrompt = pyqtSignal() + endSuppressPrompt = pyqtSignal()     def __init__(self, repo, pats, opts, embedded=False, parent=None, rev=None):   QWidget.__init__(self, parent=parent) @@ -70,6 +72,8 @@
  self.runner.output.connect(self.output)   self.runner.progress.connect(self.progress)   self.runner.makeLogVisible.connect(self.makeLogVisible) + self.runner.commandStarted.connect(self.beginSuppressPrompt) + self.runner.commandFinished.connect(self.endSuppressPrompt)   self.runner.commandFinished.connect(self.commandFinished)     layout = QVBoxLayout()
 
41
42
43
 
 
 
 
 
 
 
 
 
44
45
46
 
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@@ -41,6 +41,15 @@
  def output(self, msg, label):   self.logte.appendLog(msg, label)   + @pyqtSlot() + def beginSuppressPrompt(self): + self.logte.suppressPrompt = True + + @pyqtSlot() + def endSuppressPrompt(self): + self.logte.suppressPrompt = False + self.logte.openPrompt() +   def showEvent(self, event):   self.visibilityChanged.emit(True)  
 
354
355
356
 
 
 
 
 
 
 
 
357
358
359
 
437
438
439
 
 
 
 
 
 
 
 
 
 
 
 
 
440
441
442
 
354
355
356
357
358
359
360
361
362
363
364
365
366
367
 
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
@@ -354,6 +354,14 @@
  self._repo.invalidateui() # force reloading config immediately   self._filldefaults()   + @pyqtSlot() + def on_selectall_button_clicked(self): + self._changesets.selectAll() + + @pyqtSlot() + def on_selectnone_button_clicked(self): + self._changesets.selectNone() +  class _ChangesetsModel(QAbstractTableModel): # TODO: use component of log viewer?   _COLUMNS = [('rev', lambda ctx: '%d:%s' % (ctx.rev(), ctx)),   ('author', lambda ctx: hglib.username(ctx.user())), @@ -437,6 +445,19 @@
    return QVariant(self._COLUMNS[section][0].capitalize())   + def selectAll(self): + self._selectedrevs = set(self._revs) + self.updateAll() + + def selectNone(self): + self._selectedrevs = set() + self.updateAll() + + def updateAll(self): + first = self.createIndex(0, 0) + last = self.createIndex(len(self._revs) - 1, 0) + self.dataChanged.emit(first, last) +  def run(ui, *revs, **opts):   # TODO: same options as patchbomb   if opts.get('rev'):
 
7
8
9
10
 
11
12
13
 
357
358
359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
361
362
 
7
8
9
 
10
11
12
13
 
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
@@ -7,7 +7,7 @@
  <x>0</x>   <y>0</y>   <width>660</width> - <height>506</height> + <height>519</height>   </rect>   </property>   <property name="windowTitle"> @@ -357,6 +357,37 @@
  </property>   </widget>   </item> + <item> + <layout class="QHBoxLayout" name="selectallnone_layout"> + <item> + <widget class="QPushButton" name="selectall_button"> + <property name="text"> + <string>Select &amp;All</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="selectnone_button"> + <property name="text"> + <string>Select &amp;None</string> + </property> + </widget> + </item> + <item> + <spacer name="selectallnone_spacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item>   </layout>   </widget>   </widget>
 
570
571
572
573
574
575
576
577
578
 
 
 
 
579
580
581
 
570
571
572
 
 
 
 
573
574
575
576
577
578
579
580
581
@@ -570,12 +570,12 @@
  try:   char = s[s.index('&')+1].lower()   self.hotkeys[char] = btn - if default == i: - self.setDefaultButton(btn) - if esc == i: - self.setEscapeButton(btn)   except (ValueError, IndexError):   pass + if default == i: + self.setDefaultButton(btn) + if esc == i: + self.setEscapeButton(btn)     def run(self):   return self.exec_()
 
80
81
82
 
 
 
 
 
 
83
84
85
 
119
120
121
122
 
 
 
 
123
124
125
 
139
140
141
142
 
 
 
 
143
144
145
 
147
148
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
151
152
 
181
182
183
184
 
 
 
 
185
186
187
 
80
81
82
83
84
85
86
87
88
89
90
91
 
125
126
127
 
128
129
130
131
132
133
134
 
148
149
150
 
151
152
153
154
155
156
157
 
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
 
212
213
214
 
215
216
217
218
219
220
221
@@ -80,6 +80,12 @@
  if self.command == 'revert':   ## no backup checkbox   chk = QCheckBox(_('Do not save backup files (*.orig)')) + elif self.command == 'remove': + ## force checkbox + chk = QCheckBox(_('Force removal of modified files (--force)')) + else: + chk = None + if chk:   self.chk = chk   hbox.addWidget(chk)   @@ -119,7 +125,10 @@
  stwidget.loadSettings(s, 'quickop')   self.restoreGeometry(s.value('quickop/geom').toByteArray())   if hasattr(self, 'chk'): - self.chk.setChecked(s.value('quickop/nobackup', True).toBool()) + if self.command == 'revert': + self.chk.setChecked(s.value('quickop/nobackup', True).toBool()) + elif self.command == 'remove': + self.chk.setChecked(s.value('quickop/forceremove', False).toBool())   self.stwidget = stwidget   self.stwidget.refreshWctx()   QShortcut(QKeySequence('Ctrl+Return'), self, self.accept) @@ -139,7 +148,10 @@
  def accept(self):   cmdline = [self.command]   if hasattr(self, 'chk') and self.chk.isChecked(): - cmdline.append('--no-backup') + if self.command == 'revert': + cmdline.append('--no-backup') + elif self.command == 'remove': + cmdline.append('--force')   files = self.stwidget.getChecked()   if not files:   qtlib.WarningMsgBox(_('No files selected'), @@ -147,6 +159,25 @@
  parent=self)   return   if self.command == 'remove': + if not self.chk.isChecked(): + modified = self.repo.status()[0] + selmodified = [] + for wfile in files: + if wfile in modified: + selmodified.append(wfile) + if selmodified: + prompt = qtlib.CustomPrompt(_('Confirm Remove'), + _('You have selected one or more files that have been ' + 'modified. By default, these files will not be ' + 'removed. What would you like to do?'), self, + (_('Remove &Unmodified Files'), + _('Remove &All Selected Files'), _('Cancel')), + 0, 2, selmodified) + ret = prompt.run() + if ret == 1: + cmdline.append('--force') + elif ret == 2: + return   self.repo.bfstatus = True   self.repo.lfstatus = True   repostate = self.repo.status() @@ -181,7 +212,10 @@
  self.stwidget.saveSettings(s, 'quickop')   s.setValue('quickop/geom', self.saveGeometry())   if hasattr(self, 'chk'): - s.setValue('quickop/nobackup', self.chk.isChecked()) + if self.command == 'revert': + s.setValue('quickop/nobackup', self.chk.isChecked()) + elif self.command == 'remove': + s.setValue('quickop/forceremove', self.chk.isChecked())   QDialog.reject(self)     def addLfiles(self):
 
44
45
46
 
 
47
48
49
 
116
117
118
 
 
119
120
121
 
343
344
345
 
 
346
347
348
 
367
368
369
 
 
370
371
372
 
44
45
46
47
48
49
50
51
 
118
119
120
121
122
123
124
125
 
347
348
349
350
351
352
353
354
 
373
374
375
376
377
378
379
380
@@ -44,6 +44,8 @@
  output = pyqtSignal(QString, QString)   progress = pyqtSignal(QString, object, QString, QString, object)   makeLogVisible = pyqtSignal(bool) + beginSuppressPrompt = pyqtSignal() + endSuppressPrompt = pyqtSignal()     repoChanged = pyqtSignal(QString)   @@ -116,6 +118,8 @@
  self.runner.output.connect(self.output)   self.runner.progress.connect(self.progress)   self.runner.makeLogVisible.connect(self.makeLogVisible) + self.runner.commandStarted.connect(self.beginSuppressPrompt) + self.runner.commandFinished.connect(self.endSuppressPrompt)   self.runner.commandFinished.connect(self.onCommandFinished)     # Select the widget chosen by the user @@ -343,6 +347,8 @@
  cw.output.connect(self.output)   cw.progress.connect(self.progress)   cw.makeLogVisible.connect(self.makeLogVisible) + cw.beginSuppressPrompt.connect(self.beginSuppressPrompt) + cw.endSuppressPrompt.connect(self.endSuppressPrompt)   cw.linkActivated.connect(self._openLink)   cw.showMessage.connect(self.showMessage)   QTimer.singleShot(0, cw.reload) @@ -367,6 +373,8 @@
  sw.output.connect(self._showOutputOnInfoBar)   sw.progress.connect(self.progress)   sw.makeLogVisible.connect(self.makeLogVisible) + sw.beginSuppressPrompt.connect(self.beginSuppressPrompt) + sw.endSuppressPrompt.connect(self.endSuppressPrompt)   sw.syncStarted.connect(self.clearInfoBar)   sw.outgoingNodes.connect(self.setOutgoingNodes)   sw.showMessage.connect(self.showMessage)
 
36
37
38
39
 
 
40
41
42
 
61
62
63
 
 
64
65
66
 
288
289
290
 
291
 
292
293
294
 
295
 
 
296
297
298
 
650
651
652
 
653
654
655
 
706
707
708
 
 
 
 
709
710
711
 
902
903
904
 
905
906
907
 
909
910
911
912
 
913
914
915
 
921
922
923
 
 
 
 
 
 
 
 
 
 
 
 
924
925
926
 
928
929
930
931
 
 
932
933
934
 
1160
1161
1162
1163
 
1164
1165
1166
 
36
37
38
 
39
40
41
42
43
 
62
63
64
65
66
67
68
69
 
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
 
658
659
660
661
662
663
664
 
715
716
717
718
719
720
721
722
723
724
 
915
916
917
918
919
920
921
 
923
924
925
 
926
927
928
929
 
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
 
954
955
956
 
957
958
959
960
961
 
1187
1188
1189
 
1190
1191
1192
1193
@@ -36,7 +36,8 @@
  port = m.group(3)   folder = m.group(5) or '.'   else: - qtlib.WarningMsgBox(_('Malformed ssh URL'), hglib.tounicode(path)) + qtlib.WarningMsgBox(_('Malformed ssh URL'), hglib.tounicode(path), + parent=self)   host, port, folder = '', '', ''   elif path.startswith(('http://', 'https://', 'svn+https://')):   snpaqf = urlparse.urlparse(path) @@ -61,6 +62,8 @@
  output = pyqtSignal(QString, QString)   progress = pyqtSignal(QString, object, QString, QString, object)   makeLogVisible = pyqtSignal(bool) + beginSuppressPrompt = pyqtSignal() + endSuppressPrompt = pyqtSignal()   showBusyIcon = pyqtSignal(QString)   hideBusyIcon = pyqtSignal(QString)   @@ -288,11 +291,16 @@
  self.optionsbutton.pressed.connect(self.editOptions)     cmd = cmdui.Widget(not self.embedded, True, self) + cmd.commandStarted.connect(self.beginSuppressPrompt)   cmd.commandStarted.connect(self.commandStarted) + cmd.commandFinished.connect(self.endSuppressPrompt)   cmd.commandFinished.connect(self.commandFinished)   cmd.makeLogVisible.connect(self.makeLogVisible)   cmd.output.connect(self.output) + cmd.output.connect(self.outputHook)   cmd.progress.connect(self.progress) + if not self.embedded: + self.showMessage.connect(cmd.stbar.showMessage)     bottomlayout.addWidget(cmd)   cmd.setVisible(False) @@ -650,6 +658,7 @@
  def run(self, cmdline, details):   if self.cmd.core.running():   return + self.lastcmdline = list(cmdline)   for name in list(details) + ['remotecmd']:   val = self.opts.get(name)   if not val: @@ -706,6 +715,10 @@
  self.repo.incrementBusyCount()   self.cmd.run(cmdline, display=display, useproc='p4://' in cururl)   + def outputHook(self, msg, label): + if '\'hg push --new-branch\'' in msg: + self.needNewBranch = True +   ##   ## Workbench toolbar buttons   ## @@ -902,6 +915,7 @@
  self.run(['--repository', self.repo.root, 'p4pending', '--verbose'], ())     def pushclicked(self, confirm, rev=None, branch=None): + validopts = ('force', 'new-branch', 'branch', 'rev', 'bookmark')   self.syncStarted.emit()   url = self.currentUrl(True)   urlu = hglib.tounicode(url) @@ -909,7 +923,7 @@
  and not self.targetcheckbox.isChecked()):   r = qtlib.QuestionMsgBox(_('Confirm Push to remote Repository'),   _('Push to remote repository\n%s\n?') - % urlu) + % urlu, parent=self)   if not r:   self.showMessage.emit(_('Push to %s aborted') % urlu)   self.pushCompleted.emit() @@ -921,6 +935,18 @@
  self.showMessage.emit(_('Push to %s completed') % urlu)   else:   self.showMessage.emit(_('Push to %s aborted, ret %d') % (urlu, ret)) + if self.needNewBranch: + r = qtlib.QuestionMsgBox(_('Confirm New Branch'), + _('One or more of the changesets that you ' + 'are attempting to push involve the ' + 'creation of a new branch. Do you want ' + 'to create a new branch in the remote ' + 'repository?'), parent=self) + if r: + cmdline = self.lastcmdline + cmdline.extend(['--new-branch']) + self.run(cmdline, validopts) + return   self.pushCompleted.emit()   self.finishfunc = finished   cmdline = ['--repository', self.repo.root, 'push'] @@ -928,7 +954,8 @@
  cmdline.extend(['--rev', str(rev)])   if branch:   cmdline.extend(['--branch', branch]) - self.run(cmdline, ('force', 'new-branch', 'branch', 'rev', 'bookmark')) + self.needNewBranch = False + self.run(cmdline, validopts)     def postpullclicked(self):   dlg = PostPullDialog(self.repo, self) @@ -1160,7 +1187,7 @@
  path = self.origurl   if alias in cfg['paths']:   if not qtlib.QuestionMsgBox(_('Confirm URL replace'), - _('%s already exists, replace URL?') % alias): + _('%s already exists, replace URL?') % alias, parent=self):   return   cfg.set('paths', alias, path)   self.repo.incrementBusyCount()
 
310
311
312
313
314
 
 
315
316
317
318
 
319
320
321
 
310
311
312
 
 
313
314
315
316
317
 
318
319
320
321
@@ -310,12 +310,12 @@
  from tortoisehg.hgqt.guess import DetectRenameDialog   dlg = DetectRenameDialog(repo, parent, *files)   def matched(): - ret = True - ret = False + ret[0] = True + ret = [False]   dlg.matchAccepted.connect(matched)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_() - return ret + return ret[0]    def ignore(parent, ui, repo, files):   from tortoisehg.hgqt.hgignore import HgignoreDialog
 
654
655
656
 
 
657
658
659
 
654
655
656
657
658
659
660
661
@@ -654,6 +654,8 @@
  self.statusbar.progress(tp, p, i, u, tl, repo.root))   rw.output.connect(self.log.output)   rw.makeLogVisible.connect(self.log.setShown) + rw.beginSuppressPrompt.connect(self.log.beginSuppressPrompt) + rw.endSuppressPrompt.connect(self.log.endSuppressPrompt)   rw.revisionSelected.connect(self.updateHistoryActions)   rw.repoLinkClicked.connect(self.openLinkedRepo)   rw.taskTabsWidget.currentChanged.connect(self.updateTaskViewMenu)