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.frommercurial.errorimportRepoErrorfromtortoisehg.hgqt.qtlibimportgeticonfromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqt.quickbarimportQuickBarfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*connect=QObject.connectclassGotoQuickBar(QuickBar):def__init__(self,parent):QuickBar.__init__(self,"Goto","Ctrl+G","Goto",parent)defcreateActions(self,openkey,desc):QuickBar.createActions(self,openkey,desc)self._actions['go']=QAction("Go",self)connect(self._actions['go'],SIGNAL('triggered()'),self.goto)defgoto(self):self.emit(SIGNAL('goto'),unicode(self.entry.text()))defcreateContent(self):QuickBar.createContent(self)self.compl_model=QStringListModel(['tip'])self.completer=QCompleter(self.compl_model,self)self.entry=QLineEdit(self)self.entry.setCompleter(self.completer)self.addWidget(self.entry)self.addAction(self._actions['go'])connect(self.entry,SIGNAL('returnPressed()'),self._actions['go'].trigger)defsetVisible(self,visible=True):QuickBar.setVisible(self,visible)ifvisible:self.entry.setFocus()self.entry.selectAll()def__del__(self):# prevent a warning in the console:# QObject::startTimer: QTimer can only be used with threads started with QThreadself.entry.setCompleter(None)classHgRepoView(QTableView):""" A QTableView for displaying a HgRepoListModel, with actions, shortcuts, etc. """def__init__(self,parent=None): QTableView.__init__(self, parent)
self.init_variables()
self.setShowGrid(False)
- self.verticalHeader().hide()
-self.verticalHeader().setDefaultSectionSize(20)
++vh = self.verticalHeader()
+ vh.hide()
+vh.setDefaultSectionSize(20)
+ self.horizontalHeader().setHighlightSections(False)
+ self.setSelectionMode(QAbstractItemView.SingleSelection)
self.setSelectionBehavior(QAbstractItemView.SelectRows)
self.createActions()self.createToolbars()connect(self,SIGNAL('doubleClicked (const QModelIndex &)'),self.revisionActivated)defmousePressEvent(self,event):index=self.indexAt(event.pos())ifnotindex.isValid():returnifevent.button()==Qt.MidButton:self.gotoAncestor(index)returnQTableView.mousePressEvent(self,event)defcreateToolbars(self):self.goto_toolbar=tb=GotoQuickBar(self)tb.setObjectName("goto_toolbar")connect(tb,SIGNAL('goto'),self.goto)def_action_defs(self):a=[('back',_('Back'),'back',None,QKeySequence(QKeySequence.Back),self.back),('forward',_('Forward'),'forward',None,QKeySequence(QKeySequence.Forward),self.forward),('manifest',_('Show at rev...'),None,_('Show the manifest at selected revision'),None,self.showAtRev),('update',_('Update...'),'update',None,None,self.updateToRev),('merge',_('Merge with...'),'merge',None,None,self.mergeWithRev),('tag',_('Tag...'),'tag',None,None,self.tagToRev),('backout',_('Backout...'),None,None,None,self.backoutToRev),]returnadefcreateActions(self):self._actions={}forname,desc,icon,tip,key,cbinself._action_defs():self._actions[name]=QAction(desc,self)QTimer.singleShot(0,self.configureActions)defconfigureActions(self):forname,desc,icon,tip,key,cbinself._action_defs():act=self._actions[name]ificon:act.setIcon(geticon(icon))iftip:act.setStatusTip(tip)ifkey:act.setShortcut(key)ifcb:connect(act,SIGNAL('triggered()'),cb)self.addAction(act)defshowAtRev(self):self.emit(SIGNAL('revisionActivated'),self.current_rev)defupdateToRev(self):self.emit(SIGNAL('updateToRevision'),self.current_rev)defmergeWithRev(self):self.emit(SIGNAL('mergeWithRevision'),self.current_rev)deftagToRev(self):self.emit(SIGNAL('tagToRevision'),self.current_rev)defbackoutToRev(self):self.emit(SIGNAL('backoutToRevision'),self.current_rev)defcontextMenuEvent(self,event):menu=QMenu(self)foractin['update','manifest','merge','tag','backout',None,'back','forward']:ifact:menu.addAction(self._actions[act])else:menu.addSeparator()menu.exec_(event.globalPos())definit_variables(self):# member variablesself.current_rev=None# rev navigation history (manage 'back' action)self._rev_history=[]self._rev_pos=-1self._in_history=False# flag set when we are "in" the# history. It is required cause we cannot known, in# "revision_selected", if we are crating a new branch in the# history navigation or if we are navigating the historydefsetModel(self,model):self.init_variables()QTableView.setModel(self,model)connect(self.selectionModel(),SIGNAL('currentRowChanged (const QModelIndex & , const QModelIndex & )'),self.revisionSelected)self.goto_toolbar.compl_model.setStringList(model.repo.tags().keys())defresizeColumns(self,*args):# resize columns the smart way: the column holding Log# is resized according to the total widget size.model=self.model()ifnotmodel:returncol1_width=self.viewport().width()fontm=QFontMetrics(self.font())tot_stretch=0.0forcinrange(model.columnCount()):ifmodel._columns[c]inmodel._stretchs:tot_stretch+=model._stretchs[model._columns[c]]continuew=model.maxWidthValueForColumn(c)ifisinstance(w,int):self.setColumnWidth(c,w)elifwisnotNone:w=fontm.width(unicode(w)+'w')self.setColumnWidth(c,w)else:w=self.sizeHintForColumn(c)self.setColumnWidth(c,w)col1_width-=self.columnWidth(c)col1_width=max(col1_width,100)forcinrange(model.columnCount()):ifmodel._columns[c]inmodel._stretchs:w=model._stretchs[model._columns[c]]/tot_stretchself.setColumnWidth(c,col1_width*w)defrevFromindex(self,index):ifnotindex.isValid():returnmodel=self.model()ifmodelandmodel.graph:row=index.row()gnode=model.graph[row]returngnode.revdefrevisionActivated(self,index):rev=self.revFromindex(index)ifrevisnotNone:self.emit(SIGNAL('revisionActivated'),rev)defrevisionSelected(self,index,index_from):""" Callback called when a revision is selected in the revisions table """rev=self.revFromindex(index)ifTrue:#rev is not None:model=self.model()ifself.current_revisnotNoneandself.current_rev==rev:returnifnotself._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.emit(SIGNAL('revisionSelected'),rev)self.set_navigation_button_state()defgotoAncestor(self,index):rev=self.revFromindex(index)ifrevisnotNoneandself.current_revisnotNone:repo=self.model().repoctx=repo[self.current_rev]ctx2=repo[rev]ancestor=ctx.ancestor(ctx2)self.emit(SIGNAL('showMessage'),"Goto ancestor of %s and %s"%(ctx.rev(),ctx2.rev()),2000)self.goto(ancestor.rev())defset_navigation_button_state(self):iflen(self._rev_history)>0:back=self._rev_pos>0forw=self._rev_pos<len(self._rev_history)-1else:back=Falseforw=Falseself._actions['back'].setEnabled(back)self._actions['forward'].setEnabled(forw)defback(self):ifself._rev_historyandself._rev_pos>0:self._rev_pos-=1idx=self.model().indexFromRev(self._rev_history[self._rev_pos])ifidxisnotNone:self._in_history=Trueself.setCurrentIndex(idx)self.set_navigation_button_state()defforward(self):ifself._rev_historyandself._rev_pos<(len(self._rev_history)-1):self._rev_pos+=1idx=self.model().indexFromRev(self._rev_history[self._rev_pos])ifidxisnotNone:self._in_history=Trueself.setCurrentIndex(idx)self.set_navigation_button_state()defgoto(self,rev):""" Select revision 'rev' (can be anything understood by repo.changectx()) """rev=str(rev)# might be a QStringrepo=self.model().repotry:rev=repo.changectx(rev).rev()exceptRepoError:self.emit(SIGNAL('showMessage'),"Can't find revision '%s'"%rev,2000)else:idx=self.model().indexFromRev(rev)ifidxisnotNone:self.goto_toolbar.setVisible(False)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.