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.
If the destination path is the current directory, there are two options: If the current directory is empty, clone to this directory ('.' as dest path) If the current directory is not empty, allow mercurial to build the dest path
## TortoiseHg dialog to clone a repo## Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#importpygtkpygtk.require("2.0")importgtkimportosimportpangofromdialogimportquestion_dialog,error_dialog,info_dialogfrommercurialimporthg,ui,cmdutil,utilfrommercurial.i18nimport_frommercurial.nodeimport*importshlibclassCloneDialog(gtk.Window):""" Dialog to add tag to Mercurial repo """def__init__(self,cwd='',repos=[]):""" Initialize the Dialog """gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)shlib.set_tortoise_icon(self,'menuclone.ico')ifcwd:os.chdir(cwd)# set dialog titletitle='hg clone'self.set_title(title)self._settings=shlib.Settings('clone')self._recent_src=self._settings.mrul('src_paths')self._recent_dest=self._settings.mrul('dest_paths')sync_settings=shlib.Settings('synch')self._sync_src=sync_settings.mrul('src_paths')self._src_path=''self._dest_path=os.getcwd()iflen(repos)>1:self._src_path=repos[0]self._dest_path=repos[1]eliflen(repos):self._src_path=repos[0]# build dialogself._create()def_create(self):self.set_default_size(520,180)self.connect('destroy',gtk.main_quit)ewidth=16# add toolbar with tooltipsself.tbar=gtk.Toolbar()self.tips=gtk.Tooltips()self._btn_clone=self._toolbutton(gtk.STOCK_COPY,_('clone'),self._btn_clone_clicked,tip=_('Clone a repository'))tbuttons=[self._btn_clone,]forbtnintbuttons:self.tbar.insert(btn,-1)vbox=gtk.VBox()self.add(vbox)vbox.pack_start(self.tbar,False,False,2)# clone sourcesrcbox=gtk.HBox()lbl=gtk.Label(_('Source Path:'))lbl.set_property('width-chars',ewidth)lbl.set_alignment(0,0.5)# create drop-down list for source pathsself._srclist=gtk.ListStore(str)self._srclistbox=gtk.ComboBoxEntry(self._srclist,0)self._src_input=self._srclistbox.get_child()self._src_input.set_text(self._src_path)self._src_input.set_position(-1)# replace the drop-down widget so we can modify it's propertiesself._srclistbox.clear()cell=gtk.CellRendererText()cell.set_property('ellipsize',pango.ELLIPSIZE_MIDDLE)self._srclistbox.pack_start(cell)self._srclistbox.add_attribute(cell,'text',0)self._btn_src_browse=gtk.Button(_('Browse...'))self._btn_src_browse.connect('clicked',self._btn_src_clicked)srcbox.pack_start(lbl,False,False)srcbox.pack_start(self._srclistbox,True,True)srcbox.pack_end(self._btn_src_browse,False,False,5)vbox.pack_start(srcbox,False,False,2)# add pre-defined src paths to pull-down listsympaths=[x[1]forxinui.ui().configitems('paths')]recent=[xforxinself._recent_src]syncsrc=[xforxinself._sync_src]paths=list(set(sympaths+recent+syncsrc))paths.sort()forpinpaths:self._srclist.append([p])# clone destinationdestbox=gtk.HBox()lbl=gtk.Label(_('Destination Path:'))lbl.set_property('width-chars',ewidth)lbl.set_alignment(0,0.5)self._destlist=gtk.ListStore(str)self._destlistbox=gtk.ComboBoxEntry(self._destlist,0)self._dest_input=self._destlistbox.get_child()self._dest_input.set_text(self._dest_path)self._dest_input.set_position(-1)# replace the drop-down widget so we can modify it's propertiesself._destlistbox.clear()cell=gtk.CellRendererText()cell.set_property('ellipsize',pango.ELLIPSIZE_MIDDLE)self._destlistbox.pack_start(cell)self._destlistbox.add_attribute(cell,'text',0)self._btn_dest_browse=gtk.Button(_('Browse...'))self._btn_dest_browse.connect('clicked',self._btn_dest_clicked)destbox.pack_start(lbl,False,False)destbox.pack_start(self._destlistbox,True,True)destbox.pack_end(self._btn_dest_browse,False,False,5)vbox.pack_start(destbox,False,False,2)# add most-recent dest paths to pull-down listpaths=list(self._recent_dest)paths.sort()forpinpaths:self._destlist.append([p])# revision inputrevbox=gtk.HBox()lbl=gtk.Label(_('Clone To Revision:'))lbl.set_property('width-chars',ewidth)lbl.set_alignment(0,0.5)self._rev_input=gtk.Entry()self._rev_input.set_text("")self._opt_allrev=gtk.CheckButton(_('Clone all revisions'))self._opt_allrev.set_active(True)self._btn_rev_browse=gtk.Button(_('Select...'))self._btn_rev_browse.connect('clicked',self._btn_rev_clicked)revbox.pack_start(lbl,False,False)revbox.pack_start(self._rev_input,False,False)#revbox.pack_start(self._btn_rev_browse, False, False, 5)revbox.pack_start(self._opt_allrev,False,False)vbox.pack_start(revbox,False,False,2)# optionsoption_box=gtk.VBox()self._opt_update=gtk.CheckButton(_('do not update the new working directory'))self._opt_pull=gtk.CheckButton(_('use pull protocol to copy metadata'))self._opt_uncomp=gtk.CheckButton(_('use uncompressed transfer'))self._opt_proxy=gtk.CheckButton(_('use proxy server'))option_box.pack_start(self._opt_update,False,False)option_box.pack_start(self._opt_pull,False,False)option_box.pack_start(self._opt_uncomp,False,False)option_box.pack_start(self._opt_proxy,False,False)vbox.pack_start(option_box,False,False,15)ifui.ui().config('http_proxy','host',''):self._opt_proxy.set_active(True)else:self._opt_proxy.set_sensitive(False)# remote cmdlbl=gtk.Label(_('Remote Cmd:'))lbl.set_alignment(0,0.5)self._remote_cmd=gtk.Entry()vbox.pack_end(self._remote_cmd,False,False,1)vbox.pack_end(lbl,False,False,1)def_toolbutton(self,stock,label,handler,menu=None,userdata=None,tip=None):ifmenu:tbutton=gtk.MenuToolButton(stock)tbutton.set_menu(menu)else:tbutton=gtk.ToolButton(stock)tbutton.set_label(label)iftip:tbutton.set_tooltip(self.tips,tip)tbutton.connect('clicked',handler,userdata)returntbuttondef_btn_dest_clicked(self,button):""" select folder as clone destination """dialog=gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))dialog.set_default_response(gtk.RESPONSE_OK)response=dialog.run()ifresponse==gtk.RESPONSE_OK:self._dest_input.set_text(dialog.get_filename())dialog.destroy()def_btn_src_clicked(self,button):""" select source folder to clone """dialog=gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))dialog.set_default_response(gtk.RESPONSE_OK)response=dialog.run()ifresponse==gtk.RESPONSE_OK:self._src_input.set_text(dialog.get_filename())dialog.destroy()def_btn_rev_clicked(self,button):""" select revision from history dialog """importhistselectrev=histselect.select()ifrevisnotNone:self._rev_input.set_text(rev)def_add_src_to_recent(self,src):ifos.path.exists(src):src=os.path.abspath(src)# save path to recent list in historyself._recent_src.add(src)self._settings.write()# update drop-down listself._srclist.clear()sympaths=[x[1]forxinui.ui().configitems('paths')]paths=list(set(sympaths+[xforxinself._recent_src]))paths.sort()forpinpaths: self._srclist.append([p])
def _add_dest_to_recent(self, dest):
+ if not dest:+ return if os.path.exists(dest):
dest = os.path.abspath(dest)
# save path to recent list in historyself._recent_dest.add(dest)self._settings.write()# update drop down listpaths=list(self._recent_dest)paths.sort()self._destlist.clear()forpinpaths:self._destlist.append([p])def_btn_clone_clicked(self,toolbutton,data=None):# gather input datasrc=self._src_input.get_text()dest=self._dest_input.get_text()oros.path.basename(src)remotecmd=self._remote_cmd.get_text()rev=self._rev_input.get_text()# verify inputifsrc=='': error_dialog(self, _('Source path is empty'), _('Please enter'))
self._src_input.grab_focus()
return False
++ if dest == os.getcwd():+ if os.listdir(dest):+ # cur dir has files, specify no dest, let hg take+ # basename+ dest = None+ else:+ dest = '.' # start cloning
try:
cmdline=['hg','clone']ifself._opt_update.get_active():cmdline.append('--noupdate')ifself._opt_uncomp.get_active():cmdline.append('--uncompressed')ifself._opt_pull.get_active():cmdline.append('--pull')ifnot(self._opt_proxy.get_active()andui.ui().config('http_proxy','host','')):cmdline+=["--config","http_proxy.host="]ifremotecmd:cmdline.append('--remotecmd')cmdline.append(remotecmd)ifnotself._opt_allrev.get_active()andrev:cmdline.append('--rev')cmdline.append(rev)cmdline.append('--verbose')cmdline.append(src)ifdest:cmdline.append(dest)fromhgcmdimportCmdDialogdlg=CmdDialog(cmdline)dlg.run()dlg.hide()exceptutil.Abort,inst:error_dialog(self,_('Clone aborted'),str(inst))returnFalseexcept:importtracebackerror_dialog(self,_('Clone error'),traceback.format_exc())returnFalseself._add_src_to_recent(src)self._add_dest_to_recent(dest)defrun(cwd='',files=[],**opts):dialog=CloneDialog(cwd,repos=files)dialog.show_all()gtk.gdk.threads_init()gtk.gdk.threads_enter()gtk.main()gtk.gdk.threads_leave()if__name__=="__main__":importsysopts={}opts['cwd']=os.getcwd()opts['files']=sys.argv[1:]run(**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.