Changeset 5ccba76ce2fb…
Parent d3b135e127aa…
by
Changes to one file · Browse files at 5ccba76ce2fb Showing diff from parent d3b135e127aa Diff from another changeset...
|
|
@@ -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)
|
Loading...