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.
## TortoiseHg dialog to clone a repo## Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#importgtkimportosimportpangoimporttracebackfrommercurialimportui,utilfromthgutil.i18nimport_fromthgutilimportshlib,settingsfromhggtkimportgdialog,gtklib,hgcmdclassCloneDialog(gtk.Window):""" Dialog to clone a Mercurial repo """def__init__(self,repos=[]):""" Initialize the Dialog """gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)gtklib.set_tortoise_icon(self,'menuclone.ico')gtklib.set_tortoise_keys(self)self.set_default_size(520,180)self.set_title(_('TortoiseHg Clone'))self.ui=ui.ui()self.clonesettings=settings.Settings('clone')self.recentsrc=self.clonesettings.mrul('src_paths')self.recentdest=self.clonesettings.mrul('dest_paths')srcpath=os.getcwd()destpath=srcpathiflen(repos)>1:srcpath=repos[0]destpath=repos[1]eliflen(repos):srcpath=repos[0]ewidth=20vbox=gtk.VBox()self.add(vbox)# 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)srccombo=gtk.ComboBoxEntry(self.srclist,0)self.srcentry=srccombo.get_child()self.srcentry.set_text(srcpath)self.srcentry.set_position(-1)# replace the drop-down widget so we can modify it's propertiessrccombo.clear()cell=gtk.CellRendererText()cell.set_property('ellipsize',pango.ELLIPSIZE_MIDDLE)srccombo.pack_start(cell)srccombo.add_attribute(cell,'text',0)srcbrowse=gtk.Button(_('Browse...'))srcbrowse.connect('clicked',self.source_browse_clicked)srcbox.pack_start(lbl,False,False)srcbox.pack_start(srccombo,True,True)srcbox.pack_end(srcbrowse,False,False,5)vbox.pack_start(srcbox,False,False,2)# add pre-defined src paths to pull-down listsync_src=settings.Settings('synch').mrul('src_paths')sympaths=[x[1]forxinself.ui.configitems('paths')]recent=[xforxinself.recentsrc]syncsrc=[xforxinsync_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)destcombo=gtk.ComboBoxEntry(self.destlist,0)self.destentry=destcombo.get_child()self.destentry.set_text(destpath)self.destentry.set_position(-1)self.destentry.connect('activate',self.clone_clicked)# replace the drop-down widget so we can modify it's propertiesdestcombo.clear()cell=gtk.CellRendererText()cell.set_property('ellipsize',pango.ELLIPSIZE_MIDDLE)destcombo.pack_start(cell)destcombo.add_attribute(cell,'text',0)srcbrowse=gtk.Button(_('Browse...'))srcbrowse.connect('clicked',self.dest_browse_clicked)destbox.pack_start(lbl,False,False)destbox.pack_start(destcombo,True,True)destbox.pack_end(srcbrowse,False,False,5)vbox.pack_start(destbox,False,False,2)# add most-recent dest paths to pull-down listpaths=list(self.recentdest)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.reventry=gtk.Entry()self.reventry.set_text("")revbox.pack_start(lbl,False,False)revbox.pack_start(self.reventry,False,False)vbox.pack_start(revbox,False,False,2)# optionsoption_box=gtk.VBox()self.optupdate=gtk.CheckButton(_('do not update the new working directory'))self.optpull=gtk.CheckButton(_('use pull protocol to copy metadata'))self.optuncomp=gtk.CheckButton(_('use uncompressed transfer'))self.optproxy=gtk.CheckButton(_('use proxy server'))option_box.pack_start(self.optupdate,False,False)option_box.pack_start(self.optpull,False,False)option_box.pack_start(self.optuncomp,False,False)option_box.pack_start(self.optproxy,False,False)vbox.pack_start(option_box,False,False,15)ifself.ui.config('http_proxy','host'):self.optproxy.set_active(True)else:self.optproxy.set_sensitive(False)# remote cmdlbl=gtk.Label(_('Remote Cmd:'))lbl.set_alignment(0,0.5)self.remotecmdentry=gtk.Entry()vbox.pack_start(self.remotecmdentry,False,False,1)vbox.pack_start(lbl,False,False,1)accelgroup=gtk.AccelGroup()self.add_accel_group(accelgroup)mod=gtklib.get_thg_modifier()hbbox=gtk.HButtonBox()hbbox.set_layout(gtk.BUTTONBOX_END)vbox.pack_start(hbbox,False,False,2)close=gtk.Button(_('Cancel'))close.connect('clicked',lambdax:self.destroy())key,modifier=gtk.accelerator_parse('Escape')close.add_accelerator('clicked',accelgroup,key,0,gtk.ACCEL_VISIBLE)self.close_button=closehbbox.add(close)clone=gtk.Button(_('Clone'))key,modifier=gtk.accelerator_parse(mod+'Return')clone.add_accelerator('clicked',accelgroup,key,modifier,gtk.ACCEL_VISIBLE)clone.connect('clicked',self.clone_clicked)hbbox.add(clone)destcombo.grab_focus()defdest_browse_clicked(self,button):'select folder as clone destination'response=gtklib.NativeFolderSelectDialog(initial=self.destentry.get_text(),title=_('Select Destination Folder')).run()ifresponse:self.destentry.set_text(response)defsource_browse_clicked(self,button):'select source folder to clone'response=gtklib.NativeFolderSelectDialog( initial=self.destentry.get_text(),
title=_('Select Source Folder')).run()
if response:
- self.destentry.set_text(response)
+ self.srcentry.set_text(response)
def add_src_to_recent(self, src):
if os.path.exists(src):
src=os.path.abspath(src)# save path to recent list in historyself.recentsrc.add(src)self.clonesettings.write()# update drop-down listself.srclist.clear()sympaths=[x[1]forxinself.ui.configitems('paths')]paths=list(set(sympaths+[xforxinself.recentsrc]))paths.sort()forpinpaths:self.srclist.append([p])defadd_dest_to_recent(self,dest):ifnotdest:returnifos.path.exists(dest):dest=os.path.abspath(dest)# save path to recent list in historyself.recentdest.add(dest)self.clonesettings.write()# update drop down listpaths=list(self.recentdest)paths.sort()self.destlist.clear()forpinpaths:self.destlist.append([p])defclone_clicked(self,toolbutton,data=None):# gather input datasrc=self.srcentry.get_text()dest=self.destentry.get_text()oros.path.basename(src)remotecmd=self.remotecmdentry.get_text()rev=self.reventry.get_text()# verify inputifsrc=='':gdialog.Prompt(_('Source path is empty'),_('Please enter a valid source path'),self).run()self.srcentry.grab_focus()returnFalseifsrc==dest:gdialog.Prompt(_('Source and dest are the same'),_('Please specify a different destination'),self).run()self.destentry.grab_focus()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)# start cloningtry:cmdline=['hg','clone']ifself.optupdate.get_active():cmdline.append('--noupdate')ifself.optuncomp.get_active():cmdline.append('--uncompressed')ifself.optpull.get_active():cmdline.append('--pull')ifself.ui.config('http_proxy','host'):ifnotself.optproxy.get_active():cmdline+=['--config','http_proxy.host=']ifremotecmd:cmdline.append('--remotecmd')cmdline.append(remotecmd)ifrev:cmdline.append('--rev')cmdline.append(rev)cmdline.append('--verbose')cmdline.append(src)ifdest:cmdline.append(dest)dlg=hgcmd.CmdDialog(cmdline)dlg.run()dlg.hide()exceptutil.Abort,inst:gdialog.Prompt(_('Clone aborted'),str(inst),self).run()returnFalseexcept:gdialog.Prompt(_('Clone error'),traceback.format_exc(),self).run()returnFalseself.add_src_to_recent(src)self.add_dest_to_recent(dest)self.close_button.grab_focus()ifdlg.return_code()==0:shlib.shell_notify([dest])defrun(_ui,*pats,**opts):returnCloneDialog(pats)
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.