Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
# 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.importosfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*frommercurialimportui,cmdutil,commandsfromtortoisehg.utilimporthglibfromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqtimportcmdui,qtlibclassCloneDialog(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=Nonedest=src=cwd=os.getcwd()iflen(args)>1:src=args[0]dest=args[1]eliflen(args):src=args[0]udest=hglib.tounicode(dest)usrc=hglib.tounicode(src)ucwd=hglib.tounicode(cwd)self.prev_dest=None# base layout boxbox=QVBoxLayout()box.setSpacing(6)## main layout gridgrid=QGridLayout()grid.setSpacing(6)box.addLayout(grid)### source combo and buttonself.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 buttonself.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()fornamein('src_combo','dest_combo'):w=getattr(self,name).lineEdit()w.completer().setCaseSensitivity(Qt.CaseSensitive)s=QSettings()self.shist=s.value('clone/source').toStringList()forpathinself.shist:ifpath:self.src_combo.addItem(path)self.src_combo.setEditText(usrc)self.dhist=s.value('clone/dest').toStringList()forpathinself.dhist:ifpath:self.dest_combo.addItem(path)self.dest_combo.setEditText(udest)### optionsexpander=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)defchktext(chklabel,stretch=None):hbox=QHBoxLayout()hbox.setSpacing(0)optbox.addLayout(hbox)chk=QCheckBox(chklabel)text=QLineEdit(enabled=False)chk.toggled.connect(lambdae:self.toggle_enabled(e,text))hbox.addWidget(chk)hbox.addWidget(text)ifstretchisnotNone:hbox.addStretch(stretch)returnchk,textself.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'))self.qclone_chk=QCheckBox(_('Include patch queue'))optbox.addWidget(self.noupdate_chk)optbox.addWidget(self.pproto_chk)optbox.addWidget(self.uncomp_chk)optbox.addWidget(self.qclone_chk)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.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)+ ## 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 buttonsbuttons=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 settingself.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.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)
self.detail_btn.setHidden(True)self.show_options(False)rev=opts.get('rev')ifrev: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()
- ### Private Methods ###- 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.qclone_chk.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():+ 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])
return'startrev'inlongoptsdefclone(self):ifself.cmd.core.running():return# prepare user inputsrcQ=self.src_combo.currentText().trimmed()src=hglib.fromunicode(srcQ)destQ=self.dest_combo.currentText().trimmed()dest=hglib.fromunicode(destQ)ifnotdest:dest=os.path.basename(src)destQ=QString(hglib.tounicode(dest))ifnotdest.startswith('ssh://'):ifnotos.path.exists(dest):try:os.mkdir(dest)exceptEnvironmentError:qtlib.ErrorMsgBox(_('TortoiseHg Clone'),_('Error creating destination folder'),_('Please specify a different path.'))returnFalseifsrcQ:l=list(self.shist)ifsrcQinl:l.remove(srcQ)l.insert(0,srcQ)self.shist=l[:10]ifdestQ:l=list(self.dhist)ifdestQinl: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)
- 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'),
_('Source path is empty'),_('Please enter a valid source path.'))self.src_combo.setFocus()returnFalseifsrc==dest:qtlib.ErrorMsgBox(_('TortoiseHg Clone'),_('Source and destination are the same'),_('Please specify different paths.'))returnFalseifdest==os.getcwd():ifos.listdir(dest):# cur dir has files, specify no dest, let hg take# basenamedest=Noneelse:dest='.'else:abs=os.path.abspath(dest)dirabs=os.path.dirname(abs)ifdirabs==src: 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:
qtlib.ErrorMsgBox(_('TortoiseHg Clone'),_('Please enter a new destination path.'))self.dest_combo.setFocus()returnself.prev_dest=dest# start cloningself.cmd.run(cmdline)### Signal Handlers ###deftoggle_enabled(self,checked,target): target.setEnabled(checked)
if checked:
target.setFocus()
+ self.composeCommand() def detail_toggled(self, checked):
self.cmd.setShowOutput(checked)
defbrowse_src(self):FD=QFileDialogcaption=_("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 command_started(self):
self.cmd.setShown(True)
self.clone_btn.setHidden(True)self.close_btn.setHidden(True)self.cancel_btn.setShown(True)self.detail_btn.setShown(True)defcommand_finished(self,ret):self.ret=retifretisnot0orself.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.setFocus()self.cancel_btn.setHidden(True)else:self.accept()ifnotret:# Let the workbench know that a repository has been successfully# clonedself.clonedRepository.emit(self.dest_combo.currentText())defonCloseClicked(self):ifself.retis0:self.accept()else:self.reject()defcommand_canceling(self):self.cancel_btn.setDisabled(True)defrun(ui,*pats,**opts):returnCloneDialog(pats,opts)
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.