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.
## Repository synchronization dialog for TortoiseHg## Copyright (C) 2007 Steve Borho <steve@borho.org># Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#try:importpygtkpygtk.require("2.0")except:passimportgtkimportgobjectimportpangoimportQueueimportosimportthreadingfrommercurialimporthg,ui,utilfromdialogimporterror_dialog,question_dialogfromhglibimportHgThreadfromshlibimportset_tortoise_iconimportgtklibclassSynchDialog(gtk.Window):def__init__(self,cwd='',root='',repos=[]):""" Initialize the Dialog. """gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)set_tortoise_icon(self,'menusynch.ico')self.root=rootself.cwd=cwdself.selected_path=Noneself.set_default_size(610,400)self.paths=self._get_paths()self.origchangecount=self.repo.changelog.count()name=self.repo.ui.config('web','name')oros.path.basename(root)self.set_title("TortoiseHg Synchronize - "+name)self.connect('delete-event',self._delete)# toolbarself.tbar=gtk.Toolbar()self.tips=gtk.Tooltips()tbuttons=[self._toolbutton(gtk.STOCK_GO_DOWN,'Incoming',self._incoming_clicked,tip='Display changes that can be pulled'' from selected repository'),self._toolbutton(gtk.STOCK_GOTO_BOTTOM,' Pull ',self._pull_clicked,self._pull_menu(),tip='Pull changes from selected'' repository'),gtk.SeparatorToolItem(),self._toolbutton(gtk.STOCK_GO_UP,'Outgoing',self._outgoing_clicked,tip='Display local changes that will be pushed'' to selected repository'),self._toolbutton(gtk.STOCK_GOTO_TOP,'Push',self._push_clicked,tip='Push local changes to selected'' repository'),self._toolbutton(gtk.STOCK_GOTO_LAST,'Email',self._email_clicked,tip='Email local outgoing changes to'' one or more recipients'),gtk.SeparatorToolItem(),self._toolbutton(gtk.STOCK_PREFERENCES,'Configure',self._conf_clicked,tip='Configure peer repository paths'),gtk.SeparatorToolItem(),]forbtnintbuttons:self.tbar.insert(btn,-1)sep=gtk.SeparatorToolItem()sep.set_expand(True)sep.set_draw(False)self.tbar.insert(sep,-1)button=self._toolbutton(gtk.STOCK_CLOSE,'Quit',self._close_clicked,tip='Quit Application')self.tbar.insert(button,-1)vbox=gtk.VBox()self.add(vbox)vbox.pack_start(self.tbar,False,False,2)# revision inputrevbox=gtk.HBox()lbl=gtk.Button("Remote Path:")lbl.unset_flags(gtk.CAN_FOCUS) lbl.connect('clicked', self._btn_remotepath_clicked)
# revisions combo box
- self.revlist = gtk.ListStore(str)
- self._pathbox = gtk.ComboBoxEntry(self.revlist, 0)
+ self.pathlist = gtk.ListStore(str)
+ self._pathbox = gtk.ComboBoxEntry(self.pathlist, 0)
self._pathtext = self._pathbox.get_child()
defrow = None
defpushrow=Noneforrow,(name,path)inenumerate(self.paths):ifname=='default':defrow=rowifdefpushrowisNone: defpushrow = row
elif name == 'default-push':
defpushrow = row
- self.revlist.append([path])
+ self.pathlist.append([path])
if repos:
self._pathtext.set_text(repos[0])
elifdefrowisnotNone:self._pathbox.set_active(defrow)elifdefpushrowisnotNone:self._pathbox.set_active(defpushrow)# create checkbox to disable proxyself._use_proxy=gtk.CheckButton("use proxy server")ifui.ui().config('http_proxy','host',''):self._use_proxy.set_active(True)else:self._use_proxy.set_sensitive(False)revbox.pack_start(lbl,False,False)revbox.pack_start(self._pathbox,True,True)revbox.pack_end(self._use_proxy,False,False)vbox.pack_start(revbox,False,False,2)expander=gtk.Expander('Advanced Options')expander.set_expanded(False)hbox=gtk.HBox()expander.add(hbox)revvbox=gtk.VBox()revhbox=gtk.HBox()self._reventry=gtk.Entry()self._force=gtk.CheckButton('Force pull or push')self.tips.set_tip(self._force,'Run even when remote repository'' is unrelated.')revhbox.pack_start(gtk.Label('Target Revision:'),False,False,2)revhbox.pack_start(self._reventry,True,True,2)eventbox=gtk.EventBox()eventbox.add(revhbox)self.tips.set_tip(eventbox,'A specific revision up to which you'' would like to push or pull.')revvbox.pack_start(eventbox,True,True,8)revvbox.pack_start(self._force,False,False,2)hbox.pack_start(revvbox,True,True,4)frame=gtk.Frame('Incoming/Outgoing')hbox.pack_start(frame,False,False,2)self._showpatch=gtk.CheckButton('Show Patches')self._newestfirst=gtk.CheckButton('Show Newest First')self._nomerge=gtk.CheckButton('Show No Merges')hbox=gtk.HBox()hbox.pack_start(self._showpatch,False,False,2)hbox.pack_start(self._newestfirst,False,False,2)hbox.pack_start(self._nomerge,False,False,2)frame.add(hbox)vbox.pack_start(expander,False,False,2)# hg output windowscrolledwindow=gtk.ScrolledWindow()scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)self.textview=gtk.TextView(buffer=None)self.textview.set_editable(False)self.textview.modify_font(pango.FontDescription("Monospace"))scrolledwindow.add(self.textview)self.textview.set_editable(False)self.textbuffer=self.textview.get_buffer()vbox.pack_start(scrolledwindow,True,True)self.buttonhbox=gtk.HBox()self.viewpulled=gtk.Button('View Pulled Revisions')self.viewpulled.connect('clicked',self._view_pulled_changes)self.updatetip=gtk.Button('Update to Tip')self.updatetip.connect('clicked',self._update_to_tip)self.buttonhbox.pack_start(self.viewpulled,False,False,2)self.buttonhbox.pack_start(self.updatetip,False,False,2)vbox.pack_start(self.buttonhbox,False,False,2)self.stbar=gtklib.StatusBar()vbox.pack_start(self.stbar,False,False,2)self.connect('map',self.update_buttons)defupdate_buttons(self,*args):self.buttonhbox.hide()self.repo.invalidate()tip=self.repo.changelog.count()ifself.origchangecount==tip:self.viewpulled.hide()else:self.buttonhbox.show()self.viewpulled.show()self.repo.dirstate.invalidate()parent=self.repo.workingctx().parents()[0].rev()ifparent==tip-1:self.updatetip.hide()else:self.buttonhbox.show()self.updatetip.show()def_view_pulled_changes(self,button):fromhistoryimportGLogrevs=(self.repo.changelog.count()-1,self.origchangecount)opts={'revrange':revs}dialog=GLog(self.ui,self.repo,self.cwd,[],opts,False)dialog.display()def_update_to_tip(self,button):self.repo.invalidate()wc=self.repo.workingctx()pl=wc.parents()p1,p2=pl[0],self.repo.changectx('tip')pa=p1.ancestor(p2)warning=''flags=[]iflen(pl)>1:warning="Outstanding uncommitted merges"elifpa!=p1andpa!=p2:warning="Update spans branches"elifwc.files():warning="Outstanding uncommitted changes"ifwarning:flags=['--clean']msg='Lose all changes in your working directory?'warning+=', requires clean checkout'ifquestion_dialog(msg,warning)!=gtk.RESPONSE_YES:returnself.write("",False)# execute command and show output on text widgetgobject.timeout_add(10,self.process_queue)cmdline=['update','-v','-R',self.repo.root]+flags+['tip']self.hgthread=HgThread(cmdline)self.hgthread.start()self.stbar.begin()self.stbar.set_status_text('hg '+' '.join(cmdline))def_pull_menu(self):menu=gtk.Menu()self._pull_update=gtk.CheckMenuItem("Update to new tip")menu.append(self._pull_update)menu.show_all()returnmenudef_get_paths(self,sort="value"):""" retrieve symbolic paths """try:self.ui=ui.ui()self.repo=hg.repository(self.ui,path=self.root)paths=self.repo.ui.configitems('paths')ifsort:ifsort=="value":sortfunc=lambdaa,b:cmp(a[1],b[1])elifsort=="name":sortfunc=lambdaa,b:cmp(a[0],b[0])else:raise"unknown sort key '%s'"%sortpaths.sort(sortfunc)returnpathsexcepthg.RepoError:returnNonedef_btn_remotepath_clicked(self,button):""" select source folder to clone """dialog=gtk.FileChooserDialog(title="Select Repository",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)dialog.set_current_folder(self.root)response=dialog.run()ifresponse==gtk.RESPONSE_OK:self._pathtext.set_text(dialog.get_filename())dialog.destroy()def_close_clicked(self,toolbutton,data=None):ifthreading.activeCount()!=1:error_dialog("Can't close now","command is running")else:gtk.main_quit()def_delete(self,widget,event):ifthreading.activeCount()!=1:error_dialog("Can't close now","command is running")returnTrueelse:gtk.main_quit()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_pull_clicked(self,toolbutton,data=None):cmd=['pull']ifself._pull_update.get_active():cmd.append('--update')ifself._force.get_active():cmd.append('--force')self._exec_cmd(cmd)def_push_clicked(self,toolbutton,data=None):cmd=['push']ifself._force.get_active():cmd.append('--force')self._exec_cmd(cmd)def_conf_clicked(self,toolbutton,data=None):newpath=self._pathtext.get_text()forname,pathinself.paths:ifpath==newpath:newpath=NonebreakfromthgconfigimportConfigDialogdlg=ConfigDialog(self.root,True)dlg.show_all()ifnewpath:dlg.new_path(newpath)else:dlg.focus_field('paths.default') dlg.run()
dlg.hide()
self.paths = self._get_paths()
- self.revlist.clear()
+ self.pathlist.clear()
for row, (name, path) in enumerate(self.paths):
- self.revlist.append([path])
+ self.pathlist.append([path])
def _email_clicked(self, toolbutton, data=None):
path = self._pathtext.get_text()
ifnotpath:info_dialog('No repository selected','Select a peer repository to compare with')self._pathbox.grab_focus()returnfromhgemailimportEmailDialogdlg=EmailDialog(self.root,['--outgoing',path])dlg.set_transient_for(self)dlg.show_all()dlg.present()dlg.set_transient_for(None)def_incoming_clicked(self,toolbutton,data=None):cmd=['incoming']ifself._showpatch.get_active():cmd.append('--patch')ifself._nomerge.get_active():cmd.append('--no-merges')ifself._force.get_active():cmd.append('--force')ifself._newestfirst.get_active():cmd.append('--newest-first')self._exec_cmd(cmd)def_outgoing_clicked(self,toolbutton,data=None):cmd=['outgoing']ifself._showpatch.get_active():cmd.append('--patch')ifself._nomerge.get_active():cmd.append('--no-merges')ifself._force.get_active():cmd.append('--force')ifself._newestfirst.get_active():cmd.append('--newest-first')self._exec_cmd(cmd)def_exec_cmd(self,cmd):proxy_host=ui.ui().config('http_proxy','host','')use_proxy=self._use_proxy.get_active()text_entry=self._pathbox.get_child()remote_path=str(text_entry.get_text())cmdline=cmd[:]cmdline+=['--verbose','--repository',self.root]ifproxy_hostandnotuse_proxy:cmdline+=["--config","http_proxy.host="]cmdline+=[remote_path]# show command to be executedself.write("",False)# execute command and show output on text widgetgobject.timeout_add(10,self.process_queue)self.hgthread=HgThread(cmdline)self.hgthread.start()self.stbar.begin()self.stbar.set_status_text('hg '+' '.join(cmd+[remote_path]))defwrite(self,msg,append=True):msg=unicode(msg,'iso-8859-1')ifappend:enditer=self.textbuffer.get_end_iter()self.textbuffer.insert(enditer,msg)else:self.textbuffer.set_text(msg)defprocess_queue(self):""" Handle all the messages currently in the queue (if any). """self.hgthread.process_dialogs()whileself.hgthread.getqueue().qsize():try:msg=self.hgthread.getqueue().get(0)self.write(msg)exceptQueue.Empty:passifthreading.activeCount()==1:# Update button statesself.update_buttons()self.stbar.end()returnFalse# Stop polling this functionelse:returnTruedefrun(cwd='',root='',files=[],**opts):dialog=SynchDialog(cwd,root,files)dialog.show_all()gtk.gdk.threads_init()gtk.gdk.threads_enter()gtk.main()gtk.gdk.threads_leave()if__name__=="__main__":run(**{})
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.