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.
# repofilter.py - TortoiseHg toolbar for filtering changesets## Copyright (C) 2007-2010 Logilab. All rights reserved.# Copyright (C) 2010 Yuya Nishihara <yuya@tcha.org>## This software may be used and distributed according to the terms# of the GNU General Public License, incorporated herein by reference.fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*fromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqtimportrevset,qtlib_permanent_queries=('head()','merge()','tagged()','file(".hgsubstate") or file(".hgsub")')classRepoFilterBar(QToolBar):"""Toolbar for RepoWidget to filter changesets"""setRevisionSet=pyqtSignal(object)clearRevisionSet=pyqtSignal()filterToggled=pyqtSignal(bool)showMessage=pyqtSignal(QString)progress=pyqtSignal(QString,object,QString,QString,object)branchChanged=pyqtSignal(unicode,bool)"""Emitted (branch, allparents) when branch selection changed"""_allBranchesLabel=u'\u2605 '+_('Show all')+u' \u2605'def__init__(self,repo,parent):super(RepoFilterBar,self).__init__(parent)self.layout().setContentsMargins(0,0,0,0)self.setIconSize(QSize(16,16))self.setFloatable(False)self.setMovable(False)self._repo=repoself.filterEnabled=True#Check if the font contains the glyph needed by the branch comboifnotQFontMetrics(self.font()).inFont(QString(u'\u2605').at(0)):self._allBranchesLabel=u'*** %s ***'%_('Show all')self.entrydlg=revset.RevisionSetQuery(repo,self)self.entrydlg.progress.connect(self.progress)self.entrydlg.showMessage.connect(self.showMessage)self.entrydlg.queryIssued.connect(self.queryIssued)self.entrydlg.hide()self.revsetcombo=combo=QComboBox()combo.setEditable(True)combo.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)le=combo.lineEdit()le.returnPressed.connect(self.returnPressed)le.selectionChanged.connect(self.selectionChanged)ifhasattr(le,'setPlaceholderText'):# Qt >= 4.7le.setPlaceholderText(_('### revision set query ###'))combo.activated.connect(self.comboSelectionActivated)self.revsetle=leself.clearBtn=QToolButton(self)self.clearBtn.setIcon(qtlib.geticon('filedelete'))self.clearBtn.setToolTip(_('Clear current query and query text'))self.clearBtn.clicked.connect(self.onClearButtonClicked)self.addWidget(self.clearBtn)self.addWidget(combo)self.searchBtn=QToolButton(self)self.searchBtn.setIcon(qtlib.geticon('view-filter'))self.searchBtn.setToolTip(_('Trigger revision set query'))self.searchBtn.clicked.connect(self.returnPressed)self.addWidget(self.searchBtn)self.editorBtn=QToolButton()self.editorBtn.setText('...')self.editorBtn.setToolTip(_('Open advanced query editor'))self.editorBtn.clicked.connect(self.openEditor)self.addWidget(self.editorBtn)icon=QIcon()icon.addPixmap(QApplication.style().standardPixmap(QStyle.SP_TrashIcon))self.deleteBtn=QToolButton()self.deleteBtn.setIcon(icon)self.deleteBtn.setToolTip(_('Delete selected query from history'))self.deleteBtn.clicked.connect(self.deleteFromHistory)self.deleteBtn.setEnabled(False)self.addWidget(self.deleteBtn)self.addSeparator()self.filtercb=f=QCheckBox(_('filter'))f.toggled.connect(self.filterToggled)f.setToolTip(_('Toggle filtering of non-matched changesets'))self.addWidget(f)self.addSeparator()self._initbranchfilter()self.refresh()defonClearButtonClicked(self):ifself.revsetcombo.lineEdit().text():self.revsetcombo.lineEdit().clear()else:self.hide()self.clearRevisionSet.emit()defsetEnableFilter(self,enabled):'Enable/disable the changing of the current filter'self.revsetcombo.setEnabled(enabled)self.clearBtn.setEnabled(enabled)self.searchBtn.setEnabled(enabled)self.editorBtn.setEnabled(enabled)self.deleteBtn.setEnabled(enabled)self._branchCombo.setEnabled(enabled)self._branchLabel.setEnabled(enabled)self.filterEnabled=enableddefselectionChanged(self):selection=self.revsetcombo.lineEdit().selectedText()self.deleteBtn.setEnabled(selectioninself.revsethist)defdeleteFromHistory(self):selection=self.revsetcombo.lineEdit().selectedText()ifselectionnotinself.revsethist:returnself.revsethist.remove(selection)full=self.revsethist+list(_permanent_queries)self.revsetcombo.clear()self.revsetcombo.addItems(full)self.revsetcombo.setCurrentIndex(-1)defshowEvent(self,event):self.revsetcombo.lineEdit().setFocus()defopenEditor(self):query=self.revsetcombo.lineEdit().text().simplified()self.entrydlg.entry.setText(query)self.entrydlg.entry.setCursorPosition(0,len(query))self.entrydlg.entry.setFocus()self.entrydlg.setShown(True)@pyqtSlot(int)defcomboSelectionActivated(self,row):text=self.revsetcombo.itemText(row)self.revsetcombo.lineEdit().setText(text)self.entrydlg.entry.setText(text)self.entrydlg.runQuery()defqueryIssued(self,query,revset):self.revsetcombo.lineEdit().setText(query)ifrevset:self.setRevisionSet.emit(revset)else:self.clearRevisionSet.emit()self.saveQuery()self.revsetcombo.lineEdit().selectAll()defreturnPressed(self):'Return pressed on revset line entry, forward to dialog'query=self.revsetcombo.lineEdit().text().simplified()ifquery:self.entrydlg.entry.setText(query)self.entrydlg.runQuery()else:self.clearRevisionSet.emit()defsaveQuery(self):query=self.revsetcombo.lineEdit().text()ifqueryinself.revsethist:self.revsethist.remove(query)ifquerynotin_permanent_queries:self.revsethist.insert(0,query)self.revsethist=self.revsethist[:20]full=self.revsethist+list(_permanent_queries)self.revsetcombo.clear()self.revsetcombo.addItems(full)self.revsetcombo.lineEdit().setText(query)defloadSettings(self,s):repoid=str(self._repo[0])self.entrydlg.restoreGeometry(s.value('revset/'+repoid+'/geom').toByteArray())self.revsethist=list(s.value('revset/'+repoid+'/queries').toStringList())self.filtercb.setChecked(s.value('revset/'+repoid+'/filter',True).toBool())full=self.revsethist+list(_permanent_queries)self.revsetcombo.clear()self.revsetcombo.addItems(full)self.revsetcombo.setCurrentIndex(-1)# Show the filter bar if necessaryifs.value('revset/'+repoid+'/showrepofilterbar').toBool():self.show()else:self.hide()defsaveSettings(self,s):repoid=str(self._repo[0])s.setValue('revset/'+repoid+'/geom',self.entrydlg.saveGeometry())s.setValue('revset/'+repoid+'/queries',self.revsethist)s.setValue('revset/'+repoid+'/filter',self.filtercb.isChecked())s.setValue('revset/'+repoid+'/showrepofilterbar',notself.isHidden())def_initbranchfilter(self):self._branchLabel=QToolButton(text=_('Branch'),popupMode=QToolButton.InstantPopup,statusTip=_('Display graph the named branch only'))self._branchMenu=QMenu(self._branchLabel)self._abranchAction=self._branchMenu.addAction(_('Display only active branches'),self.refresh)self._abranchAction.setCheckable(True)self._cbranchAction=self._branchMenu.addAction(_('Display closed branches'),self.refresh)self._cbranchAction.setCheckable(True)self._allparAction=self._branchMenu.addAction(_('Include all ancestors'),self._emitBranchChanged)self._allparAction.setCheckable(True)self._branchLabel.setMenu(self._branchMenu)self._branchCombo=QComboBox()self._branchCombo.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)self._branchCombo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)self._branchCombo.currentIndexChanged.connect(self._emitBranchChanged)self._branchReloading=Falseself.addWidget(self._branchLabel)self.addWidget(self._branchCombo)def_updatebranchfilter(self):"""Update the list of branches"""curbranch=self.branch()ifself._abranchAction.isChecked():branches=sorted(set([self._repo[n].branch()forninself._repo.heads()ifnotself._repo[n].extra().get('close')]))elifself._cbranchAction.isChecked():branches=sorted(self._repo.branchtags().keys())else:branches=self._repo.namedbranchesself._branchReloading=Trueself._branchCombo.clear()self._branchCombo.addItem(self._allBranchesLabel) for branch in branches:
self._branchCombo.addItem(branch)
self._branchCombo.setItemData(self._branchCombo.count() - 1, branch, Qt.ToolTipRole)
- self._branchLabel.setEnabled(self.filterEnabled and len(branches) > 1)
- self._branchCombo.setEnabled(self.filterEnabled and len(branches) > 1)
+ self._branchLabel.setEnabled(self.filterEnabled and (len(branches) > 1 or self._abranchAction.isChecked()))
+ self._branchCombo.setEnabled(self.filterEnabled and (len(branches) > 1 or self._abranchAction.isChecked()))
self._branchReloading = False
if not curbranch:
curbranch=self._allBranchesLabelself.setBranch(curbranch)@pyqtSlot(unicode)defsetBranch(self,branch):"""Change the current branch by name [unicode]"""self._branchCombo.setCurrentIndex(self._branchCombo.findText(branch))defbranch(self):"""Return the current branch name [unicode]"""curbranch=self._branchCombo.currentText()ifcurbranch==self._allBranchesLabel:curbranch=''returnunicode(curbranch)@pyqtSlot()def_emitBranchChanged(self):ifnotself._branchReloading:self.branchChanged.emit(self.branch(),self._allparAction.isChecked())@pyqtSlot()defrefresh(self):self._updatebranchfilter()
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.