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.
# Copyright (c) 2009-2010 LOGILAB S.A. (Paris, FRANCE).# http://www.logilab.fr/ -- mailto:contact@logilab.fr## This program is free software; you can redistribute it and/or modify it under# the terms of the GNU General Public License as published by the Free Software# Foundation; either version 2 of the License, or (at your option) any later# version.## This program is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.## You should have received a copy of the GNU General Public License along with# this program; if not, write to the Free Software Foundation, Inc.,# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.frommercurialimporterrorfromtortoisehg.utilimporthglibfromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqtimporthtmldelegatefromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*classHgRepoView(QTableView):revisionClicked=pyqtSignal(object)revisionAltClicked=pyqtSignal(object)revisionSelected=pyqtSignal(object)revisionActivated=pyqtSignal(object)menuRequested=pyqtSignal(QPoint,object)showMessage=pyqtSignal(unicode)def__init__(self,repo,parent=None):QTableView.__init__(self,parent)self.repo=repoself.current_rev=-1self.setShowGrid(False)vh=self.verticalHeader()vh.hide()vh.setDefaultSectionSize(20)self.horizontalHeader().setHighlightSections(False)self.standardDelegate=self.itemDelegate()self.htmlDelegate=htmldelegate.HTMLDelegate(self)self.setSelectionMode(QAbstractItemView.ExtendedSelection)self.setSelectionBehavior(QAbstractItemView.SelectRows)self.doubleClicked.connect(self.revActivated)self.clicked.connect(self.revClicked)defsetRepo(self,repo):self.repo=repodefmousePressEvent(self,event):index=self.indexAt(event.pos())ifnotindex.isValid():returnifevent.button()==Qt.MidButton:self.gotoAncestor(index)returnQTableView.mousePressEvent(self,event)defcontextMenuEvent(self,event):self.menuRequested.emit(event.globalPos(),self.selectedRevisions())defsetModel(self,model):QTableView.setModel(self,model)#Check if the font contains the glyph needed by the model if not QFontMetrics(self.font()).inFont(QString(u'\u2605').at(0)):
model.unicodestar = False
if not QFontMetrics(self.font()).inFont(QString(u'\u2327').at(0)):
- model.unicodeclosed = False
+ model.unicodexinabox = False
self.selectionModel().currentRowChanged.connect(self.onRowChange)
self.resetDelegate()
self._rev_history = []
self._rev_pos=-1self._in_history=Falsemodel.layoutChanged.connect(self.resetDelegate)defresetBrowseHistory(self,revs):self._rev_history=revs[:]self._rev_pos=-1self.forward()defresetDelegate(self):# Model column layout has changed so we need to move# our column delegate to correct locationifnotself.model():returnmodel=self.model()forcinrange(model.columnCount(QModelIndex())):ifmodel._columns[c]in['Description','Changes']:self.setItemDelegateForColumn(c,self.htmlDelegate)else:self.setItemDelegateForColumn(c,self.standardDelegate)defresizeColumns(self,*args):# resize columns the smart way: the column holding Description# is resized according to the total widget size.ifnotself.model():returnhh=self.horizontalHeader()hh.setStretchLastSection(False)self._resizeColumns()hh.setStretchLastSection(True)def_resizeColumns(self):# _resizeColumns misbehaves if called with last section strechedforc,winenumerate(self._columnWidthHints()):self.setColumnWidth(c,w)defsizeHintForColumn(self,column):returnself._columnWidthHints()[column]def_columnWidthHints(self):"""Return list of recommended widths of all columns"""model=self.model()col1_width=self.viewport().width()fontm=QFontMetrics(self.font())tot_stretch=0.0widths=[-1for_iinxrange(model.columnCount(QModelIndex()))]forcinrange(model.columnCount(QModelIndex())):ifmodel._columns[c]inmodel._stretchs:tot_stretch+=model._stretchs[model._columns[c]]continuew=model.maxWidthValueForColumn(c)ifisinstance(w,int):widths[c]=welifwisnotNone:w=fontm.width(hglib.tounicode(str(w))+'w')widths[c]=welse:w=super(HgRepoView,self).sizeHintForColumn(c)widths[c]=wcol1_width-=widths[c]col1_width=max(col1_width,100)forcinrange(model.columnCount(QModelIndex())):ifmodel._columns[c]inmodel._stretchs:w=model._stretchs[model._columns[c]]/tot_stretchwidths[c]=col1_width*wreturnwidthsdefrevFromindex(self,index):ifnotindex.isValid():returnmodel=self.model()ifmodelandmodel.graph:row=index.row()gnode=model.graph[row]returngnode.revdefcontext(self,rev):returnself.repo.changectx(rev)defrevClicked(self,index):rev=self.revFromindex(index)ifQApplication.keyboardModifiers()&Qt.AltModifier:self.revisionAltClicked.emit(rev)else:self.revisionClicked.emit(rev)defrevActivated(self,index):rev=self.revFromindex(index)ifrevisnotNone:self.revisionActivated.emit(rev)defonRowChange(self,index,index_from):rev=self.revFromindex(index)ifself.current_rev!=revandnotself._in_history:delself._rev_history[self._rev_pos+1:]self._rev_history.append(rev)self._rev_pos=len(self._rev_history)-1self._in_history=Falseself.current_rev=revself.revisionSelected.emit(rev)defselectedRevisions(self):"""Return the list of selected revisions"""selmodel=self.selectionModel()return[self.revFromindex(i)foriinselmodel.selectedRows()]defgotoAncestor(self,index):rev=self.revFromindex(index)ifrevisNoneorself.current_revisNone:returnctx=self.context(self.current_rev)ctx2=self.context(rev)ifctx.thgmqunappliedpatch()orctx2.thgmqunappliedpatch():returnancestor=ctx.ancestor(ctx2)self.showMessage.emit(_("Goto ancestor of %s and %s")%(ctx.rev(),ctx2.rev()))self.goto(ancestor.rev())defcanGoBack(self):returnbool(self._rev_historyandself._rev_pos>0)defcanGoForward(self):returnbool(self._rev_historyandself._rev_pos<len(self._rev_history)-1)defback(self):ifself.canGoBack():self._rev_pos-=1idx=self.model().indexFromRev(self._rev_history[self._rev_pos])ifidxisnotNone:self._in_history=Trueself.setCurrentIndex(idx)defforward(self):ifself.canGoForward():self._rev_pos+=1idx=self.model().indexFromRev(self._rev_history[self._rev_pos])ifidxisnotNone:self._in_history=Trueself.setCurrentIndex(idx)defgoto(self,rev):""" Select revision 'rev' (can be anything understood by repo.changectx()) """iftype(rev)isQString:rev=str(rev)try:rev=self.repo.changectx(rev).rev()excepterror.RepoError:self.showMessage.emit(_("Can't find revision '%s'")%rev)exceptLookupError,e:self.showMessage.emit(hglib.fromunicode(str(e)))else:idx=self.model().indexFromRev(rev)ifidxisnotNone:self.setCurrentIndex(idx)
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.