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 add tag## Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#importosimportgtkimporttracebackfrommercurialimporthg,ui,utilfromthgutil.i18nimport_fromthgutilimporthglibfromhggtkimportdialog,gtklibclassTagAddDialog(gtk.Window):""" Dialog to add tag to Mercurial repo """def__init__(self,root='',tag='',rev=''):""" Initialize the Dialog """gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)gtklib.set_tortoise_keys(self)title=_('TortoiseHg Tag - %s')%(rootoros.getcwd())self.set_title(title)self.root=rootself.repo=Nonetry:self.repo=hg.repository(ui.ui(),path=self.root)excepthglib.RepoError:pass# build dialogself._create(tag,rev)def_create(self,tag,rev):self.set_default_size(350,180)# add toolbar with tooltipsself.tbar=gtk.Toolbar()self.tips=gtk.Tooltips()self._btn_addtag=self._toolbutton(gtk.STOCK_ADD,_('Add'),self._btn_addtag_clicked,tip=_('Add tag to selected version'))self._btn_rmtag=self._toolbutton(gtk.STOCK_DELETE,_('Remove'),self._btn_rmtag_clicked,tip=_('Remove tag from repository'))tbuttons=[self._btn_addtag,self._btn_rmtag]forbtnintbuttons:self.tbar.insert(btn,-1)vbox=gtk.VBox()self.add(vbox)vbox.pack_start(self.tbar,False,False,2)# tag name inputtagbox=gtk.HBox()lbl=gtk.Label(_('Tag:'))lbl.set_property('width-chars',10)lbl.set_alignment(0,0.5)self._tagslist=gtk.ListStore(str)self._taglistbox=gtk.ComboBoxEntry(self._tagslist,0)self._tag_input=self._taglistbox.get_child()self._tag_input.set_text(tag)tagbox.pack_start(lbl,False,False)tagbox.pack_start(self._taglistbox,True,True)vbox.pack_start(tagbox,True,True,2)# revision inputrevbox=gtk.HBox()lbl=gtk.Label(_('Revision:'))lbl.set_property('width-chars',10)lbl.set_alignment(0,0.5)self._rev_input=gtk.Entry()self._rev_input.set_text(rev)revbox.pack_start(lbl,False,False)revbox.pack_start(self._rev_input,False,False)vbox.pack_start(revbox,False,False,2)# tag optionsoption_box=gtk.VBox()self._local_tag=gtk.CheckButton(_('Tag is local'))self._replace_tag=gtk.CheckButton(_('Replace existing tag'))self._use_msg=gtk.CheckButton(_('Use custom commit message'))option_box.pack_start(self._local_tag,False,False)option_box.pack_start(self._replace_tag,False,False)option_box.pack_start(self._use_msg,False,False)vbox.pack_start(option_box,False,False,15)# commit messagelbl=gtk.Label(_('Commit message:'))lbl.set_alignment(0,0.5)self._commit_message=gtk.Entry() vbox.pack_end(self._commit_message, False, False, 1)
vbox.pack_end(lbl, False, False, 1)
+ # focus on tag input+ self._taglistbox.grab_focus()+ # show them all
self._refresh()
vbox.show_all()
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_refresh(self):""" update display on dialog with recent repo data """self.repo.invalidate()self._tagslist.clear()self._tag_input.set_text("")# add tags to drop-down listtags=[x[0]forxinself.repo.tagslist()]tags.sort()fortagnameintags:iftagname=="tip":continueself._tagslist.append([tagname])def_btn_tag_clicked(self,button):""" select tag from tags dialog """importtagstag=tags.select(self.root)iftagisnotNone:self._tag_input.set_text(tag)def_btn_addtag_clicked(self,button,data=None):self._do_add_tag()def_btn_rmtag_clicked(self,button,data=None):self._do_rm_tag()def_do_add_tag(self):# gather input datais_local=self._local_tag.get_active()name=self._tag_input.get_text()rev=self._rev_input.get_text()force=self._replace_tag.get_active()use_msg=self._use_msg.get_active()message=self._commit_message.get_text()# verify inputifname=='':dialog.error_dialog(self,_('Tag input is empty'),_('Please enter tag name'))self._tag_input.grab_focus()returnFalseifuse_msgandnotmessage:dialog.error_dialog(self,_('Custom commit message is empty'),_('Please enter commit message'))self._commit_message.grab_focus()returnFalse# add tag to repotry:self._add_hg_tag(name,rev,message,is_local,force=force)dialog.info_dialog(self,_('Tagging completed'),_('Tag "%s" has been added')%name)self._refresh()exceptutil.Abort,inst:dialog.error_dialog(self,_('Error in tagging'),str(inst))returnFalseexcept:dialog.error_dialog(self,_('Error in tagging'),traceback.format_exc())returnFalsedef_do_rm_tag(self):# gather input datais_local=self._local_tag.get_active()name=self._tag_input.get_text()use_msg=self._use_msg.get_active()# verify inputifname=='':dialog.error_dialog(self,_('Tag name is empty'),_('Please select tag name to remove'))self._tag_input.grab_focus()returnFalseifuse_msg:message=self._commit_message.get_text()else:message=''try:self._rm_hg_tag(name,message,is_local)dialog.info_dialog(self,_('Tagging completed'),_('Tag "%s" has been removed')%name)self._refresh()exceptutil.Abort,inst:dialog.error_dialog(self,_('Error in tagging'),str(inst))returnFalseexcept:dialog.error_dialog(self,_('Error in tagging'),traceback.format_exc())returnFalsedef_add_hg_tag(self,name,revision,message,local,user=None,date=None,force=False):ifnameinself.repo.tags()andnotforce:raiseutil.Abort(_('a tag named "%s" already exists')%name)ctx=self.repo[revision]r=ctx.node()ifnotmessage:message=_('Added tag %s for changeset %s')%(name,str(ctx))ifnameinself.repo.tags()andnotforce:raiseutil.Abort(_("Tag '%s' already exist")%name)self.repo.tag(name,r,hglib.fromutf(message),local,user,date)def_rm_hg_tag(self,name,message,local,user=None,date=None):ifnotnameinself.repo.tags():raiseutil.Abort(_("Tag '%s' does not exist")%name)ifnotmessage:message=_('Removed tag %s')%namer=self.repo[-1].node()self.repo.tag(name,r,message,local,user,date)
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.