Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

clone: add a 'Hg command' textbox

Changeset 5ccba76ce2fb

Parent d3b135e127aa

by Johan Samyn

Changes to one file · Browse files at 5ccba76ce2fb Showing diff from parent d3b135e127aa Diff from another changeset...

 
139
140
141
 
 
 
 
 
 
 
142
143
144
 
170
171
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
174
175
 
187
188
189
 
 
 
 
 
 
 
190
191
192
193
194
195
196
197
 
205
206
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
209
210
 
248
249
250
251
252
253
254
255
256
257
 
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
 
326
327
328
 
329
330
331
 
338
339
340
 
341
342
343
 
347
348
349
 
350
351
352
 
139
140
141
142
143
144
145
146
147
148
149
150
151
 
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
 
208
209
210
211
212
213
214
215
216
217
218
219
220
 
 
221
222
223
 
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
 
310
311
312
 
 
 
 
313
314
315
 
338
339
340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
342
343
344
345
346
 
359
360
361
362
363
364
365
 
372
373
374
375
376
377
378
 
382
383
384
385
386
387
388
@@ -139,6 +139,13 @@
  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) +   ## command widget   self.cmd = cmdui.Widget(True, True, self)   self.cmd.commandStarted.connect(self.command_started) @@ -170,6 +177,20 @@
  self.setWindowTitle(_('Clone - %s') % ucwd)   self.setWindowIcon(qtlib.geticon('hg-clone'))   + # connect extra signals + self.src_combo.editTextChanged.connect(self.composeCommand) + 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.proxy_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) @@ -187,11 +208,16 @@
  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()   - ### Private Methods ### -   def show_options(self, visible):   self.rev_chk.setVisible(visible)   self.rev_text.setVisible(visible) @@ -205,6 +231,42 @@
  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(): + cmdline = ['qclone'] + 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() + cmdline.append(src) + dest = self.getDest() + if dest: + cmdline.append('--') + 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]) @@ -248,10 +310,6 @@
  s.setValue('clone/source', self.shist)   s.setValue('clone/dest', self.dhist)   - remotecmd = hglib.fromunicode(self.remote_text.text().trimmed()) - rev = hglib.fromunicode(self.rev_text.text().trimmed()) - startrev = hglib.fromunicode(self.startrev_text.text().trimmed()) -   # verify input   if src == '':   qtlib.ErrorMsgBox(_('TortoiseHg Clone'), @@ -280,34 +338,9 @@
  dest = os.path.join(os.path.dirname(dirabs), dest)     # prepare command line - if self.qclone_chk.isChecked(): - cmdline = ['qclone'] - 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') - cmdline.append(src) - if dest: - cmdline.append('--') - cmdline.append(dest) + 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: @@ -326,6 +359,7 @@
  target.setEnabled(checked)   if checked:   target.setFocus() + self.composeCommand()     def detail_toggled(self, checked):   self.cmd.setShowOutput(checked) @@ -338,6 +372,7 @@
  if path:   self.src_combo.setEditText(QDir.toNativeSeparators(path))   self.dest_combo.setFocus() + self.composeCommand()     def browse_dest(self):   FD = QFileDialog @@ -347,6 +382,7 @@
  if path:   self.dest_combo.setEditText(QDir.toNativeSeparators(path))   self.dest_combo.setFocus() + self.composeCommand()     def command_started(self):   self.cmd.setShown(True)