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.
Because util.i18n returns 'utf-8' string instead of local string, non-English commit message becomes invalid on non-UTF-8 environment. This fixes the problem by using hgqt.i18n, which returns unicode object.
Now message is always unicode, this removes if-clause to skip hglib.fromunicode.
# tag.py - Tag dialog for TortoiseHg## 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.
-from tortoisehg.util import hglib, i18n+from tortoisehg.util import hglib
from tortoisehg.hgqt.i18n import _
-from tortoisehg.hgqt import qtlib, cmdui
+from tortoisehg.hgqt import qtlib, cmdui, i18nfrom PyQt4.QtCore import *
from PyQt4.QtGui import *
keep=i18n.keepgettext()classTagDialog(QDialog):showMessage=pyqtSignal(QString)output=pyqtSignal(QString,QString)makeLogVisible=pyqtSignal(bool)def__init__(self,repo,tag='',rev='tip',parent=None,opts={}):super(TagDialog,self).__init__(parent)self.setWindowFlags(self.windowFlags()& \
~Qt.WindowContextHelpButtonHint)self.repo=repoself.setWindowTitle(_('Tag - %s')%repo.displayname)self.setWindowIcon(qtlib.geticon('hg-tag'))# base layout boxbase=QVBoxLayout()base.setSpacing(0)base.setContentsMargins(*(0,)*4)base.setSizeConstraint(QLayout.SetFixedSize)self.setLayout(base)# main layout boxbox=QVBoxLayout()box.setSpacing(8)box.setContentsMargins(*(8,)*4)self.layout().addLayout(box)form=QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow)box.addLayout(form)ctx=repo[rev]form.addRow(_('Revision:'),QLabel('%d (%s)'%(ctx.rev(),ctx)))self.rev=ctx.rev()### tag comboself.tagCombo=QComboBox()self.tagCombo.setEditable(True)self.tagCombo.setEditText(hglib.tounicode(tag))self.tagCombo.currentIndexChanged.connect(self.updateStates)self.tagCombo.editTextChanged.connect(self.updateStates)form.addRow(_('Tag:'),self.tagCombo)self.tagRevLabel=QLabel('')form.addRow(_('Tagged:'),self.tagRevLabel)### optionsexpander=qtlib.ExpanderLabel(_('Options'),False)expander.expanded.connect(self.show_options)box.addWidget(expander)optbox=QVBoxLayout()optbox.setSpacing(6)box.addLayout(optbox)hbox=QHBoxLayout()hbox.setSpacing(0)optbox.addLayout(hbox)self.localCheckBox=QCheckBox(_('Local tag'))self.localCheckBox.toggled.connect(self.updateStates)self.replaceCheckBox=QCheckBox(_('Replace existing tag (-f/--force)'))self.replaceCheckBox.toggled.connect(self.updateStates)optbox.addWidget(self.localCheckBox)optbox.addWidget(self.replaceCheckBox)self.englishCheckBox=QCheckBox(_('Use English commit message'))engmsg=repo.ui.configbool('tortoisehg','engmsg',False)self.englishCheckBox.setChecked(engmsg)optbox.addWidget(self.englishCheckBox)self.customCheckBox=QCheckBox(_('Use custom commit message:'))self.customCheckBox.toggled.connect(self.customMessageToggle)self.customTextLineEdit=QLineEdit()optbox.addWidget(self.customCheckBox)optbox.addWidget(self.customTextLineEdit)## bottom buttonsBB=QDialogButtonBoxbbox=QDialogButtonBox(BB.Close)bbox.rejected.connect(self.reject)self.addBtn=bbox.addButton(_('&Add'),BB.ActionRole)self.removeBtn=bbox.addButton(_('&Remove'),BB.ActionRole)box.addWidget(bbox)self.addBtn.clicked.connect(self.onAddTag)self.removeBtn.clicked.connect(self.onRemoveTag)## horizontal separatorself.sep=QFrame()self.sep.setFrameShadow(QFrame.Sunken)self.sep.setFrameShape(QFrame.HLine)base.addWidget(self.sep)## status lineself.status=qtlib.StatusLabel()self.status.setContentsMargins(4,2,4,4)base.addWidget(self.status)self.cmd=cmdui.Runner(False,self)self.cmd.output.connect(self.output)self.cmd.makeLogVisible.connect(self.makeLogVisible)self.cmd.commandFinished.connect(self.onCommandFinished)repo.repositoryChanged.connect(self.refresh)self.customTextLineEdit.setDisabled(True)self.replaceCheckBox.setChecked(bool(opts.get('force')))self.localCheckBox.setChecked(bool(opts.get('local')))ifnotopts.get('local')andopts.get('message'):msg=hglib.tounicode(opts['message'])self.customCheckBox.setChecked(True)self.customTextLineEdit.setText(msg)self.clear_statue()self.show_options(False)self.tagCombo.setFocus()self.refresh()@pyqtSlot()defrefresh(self):""" update display on dialog with recent repo data """cur=self.tagCombo.currentText()tags=list(self.repo.tags())tags.sort(reverse=True)self.tagCombo.clear()fortagintags:iftagin('tip','qbase','qtip','qparent'):continueself.tagCombo.addItem(hglib.tounicode(tag))ifcur:self.tagCombo.setEditText(cur)else:self.tagCombo.clearEditText()self.updateStates()@pyqtSlot()defupdateStates(self):""" update bottom button sensitives based on rev and tag """tagu=self.tagCombo.currentText()tag=hglib.fromunicode(tagu)# check tag existenceiftag:exists=taginself.repo.tags()ifexists:tagtype=self.repo.tagtype(tag)islocal='local'==tagtypetry:ctx=self.repo[self.repo.tags()[tag]]trev=ctx.rev()thash=str(ctx)except:trev,thash,local=0,'????????',''self.localCheckBox.setChecked(islocal)self.localCheckBox.setEnabled(False)local=islocaland_('local')or''self.tagRevLabel.setText('%d (%s) %s'%(trev,thash,local))samerev=trev==self.revelse:islocal=self.localCheckBox.isChecked()self.localCheckBox.setEnabled(True)self.tagRevLabel.clear()force=self.replaceCheckBox.isChecked()custom=self.customCheckBox.isChecked()self.addBtn.setEnabled(notexistsor(forceandnotsamerev))ifexistsandnotsamerev:self.addBtn.setText(_('Move'))else:self.addBtn.setText(_('Add'))self.removeBtn.setEnabled(exists)self.englishCheckBox.setEnabled(notislocal)self.customCheckBox.setEnabled(notislocal)self.customTextLineEdit.setEnabled(notislocalandcustom)else:self.addBtn.setEnabled(False)self.removeBtn.setEnabled(False)self.localCheckBox.setEnabled(False)self.englishCheckBox.setEnabled(False)self.customCheckBox.setEnabled(False)self.customTextLineEdit.setEnabled(False)self.tagRevLabel.clear()defcustomMessageToggle(self,checked):self.customTextLineEdit.setEnabled(checked)ifchecked:self.customTextLineEdit.setFocus()defshow_options(self,visible):self.localCheckBox.setVisible(visible)self.replaceCheckBox.setVisible(visible)self.englishCheckBox.setVisible(visible)self.customCheckBox.setVisible(visible)self.customTextLineEdit.setVisible(visible)defset_status(self,text,icon):self.status.setShown(True)self.sep.setShown(True)self.status.set_status(text,icon)self.showMessage.emit(text)defclear_statue(self):self.status.setHidden(True)self.sep.setHidden(True)defonCommandFinished(self,ret):ifret==0:self.finishfunc()defonAddTag(self):tagu=self.tagCombo.currentText()tag=hglib.fromunicode(tagu)local=self.localCheckBox.isChecked()force=self.replaceCheckBox.isChecked()english=self.englishCheckBox.isChecked()ifself.customCheckBox.isChecked():message=self.customTextLineEdit.text()else:message=Noneexists=taginself.repo.tags()ifexistsandnotforce:self.set_status(_("Tag '%s' already exists")%tagu,False)returnifnotlocal:parents=self.repo.parents()iflen(parents)>1:self.set_status(_('uncommitted merge'),False)returnp1=parents[0]ifnotforceandp1.node()notinself.repo._branchheads:self.set_status(_('not at a branch head (use force)'),False)returnifnotmessage: ctx = self.repo[self.rev]
msgset = keep._('Added tag %s for changeset %s')
message = (english and msgset['id'] or msgset['str']) \
- % (tag, str(ctx))
- if not isinstance(message, str):- message = hglib.fromunicode(message)
+ % (tagu, str(ctx))
+ message = hglib.fromunicode(message)
def finished():
if exists:
self.set_status(_("Tag '%s' has been moved")%tagu,True)else:self.set_status(_("Tag '%s' has been added")%tagu,True)cmd=['tag','--repository',self.repo.root,'--rev',str(self.rev)]iflocal:cmd.append('--local')else:cmd.append('--message=%s'%message)ifforce:cmd.append('--force')cmd.append(tag)self.finishfunc=finishedself.cmd.run(cmd)defonRemoveTag(self):tagu=self.tagCombo.currentText()tag=hglib.fromunicode(tagu)local=self.localCheckBox.isChecked()force=self.replaceCheckBox.isChecked()english=self.englishCheckBox.isChecked()ifself.customCheckBox.isChecked():message=self.customTextLineEdit.text()else:message=Nonetagtype=self.repo.tagtype(tag)iflocal:iftagtype!='local':self.set_status(_("tag '%s' is not a local tag")%tagu)returnelse:iftagtype!='global':self.set_status(_("tag '%s' is not a global tag")%tagu)returnparents=self.repo.parents()iflen(parents)>1:self.set_status(_('uncommitted merge'),False)returnp1=parents[0]ifnotforceandp1.node()notinself.repo._branchheads:self.set_status(_('not at a branch head (use force)'),False) return
if not message:
msgset = keep._('Removed tag %s')
- message = (english and msgset['id'] or msgset['str']) % tag- if not isinstance(message, str):- message = hglib.fromunicode(message)
+ message = (english and msgset['id'] or msgset['str']) % tagu+ message = hglib.fromunicode(message)
def finished():
self.set_status(_("Tag '%s' has been removed") % tagu, True)
cmd=['tag','--repository',self.repo.root,'--remove']iflocal:cmd.append('--local')else:cmd.append('--message=%s'%message)cmd.append(tag)self.finishfunc=finishedself.cmd.run(cmd)defrun(ui,*pats,**opts):kargs={}tag=len(pats)>0andpats[0]orNoneiftag:kargs['tag']=tagrev=opts.get('rev')ifrev:kargs['rev']=revfromtortoisehg.utilimportpathsfromtortoisehg.hgqtimportthgreporepo=thgrepo.repository(ui,path=paths.find_root())returnTagDialog(repo,opts=opts,**kargs)
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.