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.importosfromtortoisehg.utilimporthglibfromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqt.qtlibimportgeticonfromtortoisehg.hgqt.filedialogsimportFileLogDialog,FileDiffDialogfromtortoisehg.hgqtimportvisdiff,wctxactions,revertfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*classHgFileListView(QTableView):""" A QTableView for displaying a HgFileListModel """fileRevSelected=pyqtSignal(object,object,object)clearDisplay=pyqtSignal()contextmenu=Nonedef__init__(self,parent=None):QTableView.__init__(self,parent)self.setShowGrid(False)self.horizontalHeader().hide()self.verticalHeader().hide()self.verticalHeader().setDefaultSectionSize(20)self.setSelectionMode(QAbstractItemView.SingleSelection)self.setSelectionBehavior(QAbstractItemView.SelectRows)self.setTextElideMode(Qt.ElideLeft)self.createActions()self.doubleClicked.connect(self.fileActivated)self._diff_dialogs={}self._nav_dialogs={}defsetModel(self,model):QTableView.setModel(self,model)model.layoutChanged.connect(self.layoutChanged)self.selectionModel().currentRowChanged.connect(self.fileSelected)self.horizontalHeader().setResizeMode(1,QHeaderView.Stretch)defcurrentFile(self):index=self.currentIndex()returnself.model().fileFromIndex(index)deflayoutChanged(self):'file model has new contents'index=self.currentIndex()ifindex.row()>=len(self.model()):self.selectRow(0)else:self.selectRow(index.row())self.fileSelected()deffileSelected(self,index=None,*args):ifindexisNone:index=self.currentIndex()sel_file=self.model().fileFromIndex(index)from_rev=self.model().revFromIndex(index)status=self.model().flagFromIndex(index)ifsel_file:self.fileRevSelected.emit(sel_file,from_rev,status)else:self.clearDisplay.emit()defselectFile(self,filename):index=self.model().indexFromFile(filename)self.setCurrentIndex(index)self.fileSelected(index)deffileActivated(self,index,alternate=False):sel_file=self.model().fileFromIndex(index)ifalternate:self.navigate(sel_file)else:self.diffNavigate(sel_file)defnavigate(self,filename=None):self._navigate(filename,FileLogDialog,self._nav_dialogs)defdiffNavigate(self,filename=None):self._navigate(filename,FileDiffDialog,self._diff_dialogs)defvdiff(self):filename=self.currentFile()iffilenameisNone:returnmodel=self.model()pats=[filename]opts={'change':str(model._ctx.rev())}dlg=visdiff.visualdiff(model.repo.ui,model.repo,pats,opts)ifdlg:dlg.exec_()defvdifflocal(self):filename=self.currentFile()iffilenameisNone:returnmodel=self.model()pats=[filename]opts={'rev':[str(model._ctx.rev())]}dlg=visdiff.visualdiff(model.repo.ui,model.repo,pats,opts)ifdlg:dlg.exec_()defeditfile(self):filename=self.currentFile()iffilenameisNone:returnmodel=self.model()repo=model.reporev=model._ctx.rev()ifrevisNone:files=[repo.wjoin(filename)]wctxactions.edit(self,repo.ui,repo,files)else:base,_=visdiff.snapshot(repo,[filename],repo[rev])files=[os.path.join(base,filename)]wctxactions.edit(self,repo.ui,repo,files)defeditlocal(self):filename=self.currentFile()iffilenameisNone:returnmodel=self.model()repo=model.repopath=repo.wjoin(filename)wctxactions.edit(self,repo.ui,repo,[path])defrevertfile(self):filename=self.currentFile()iffilenameisNone:returnmodel=self.model()repo=model.reporev=model._ctx.rev()dlg=revert.RevertDialog(repo,filename,rev,self)dlg.exec_()def_navigate(self,filename,dlgclass,dlgdict):ifnotfilename:filename=self.currentFile()model=self.model()iffilenameisnotNoneandlen(model.repo.file(filename))>0:iffilenamenotindlgdict: dlg = dlgclass(model.repo, filename,
repoviewer=self.window())
dlgdict[filename] = dlg
- dlg.setWindowTitle(_('Hg file log viewer - %s') % filename)
+ ufname = hglib.tounicode(filename)+ dlg.setWindowTitle(_('Hg file log viewer - %s') % ufname)
dlg = dlgdict[filename]
dlg.goto(model._ctx.rev())
dlg.show()
dlg.raise_()dlg.activateWindow()defcreateActions(self):self._actions={}forname,desc,icon,key,tip,cbin[('navigate',_('File history'),None,'Shift+Return',_('Show the history of the selected file'),self.navigate),('diffnavigate',_('Compare file revisions'),None,None,_('Compare revisions of the selected file'),self.diffNavigate),('diff',_('Visual Diff'),None,'Ctrl+D',_('View file changes in external diff tool'),self.vdiff),('ldiff',_('Visual Diff to Local'),None,'Shift+Ctrl+D',_('View changes to current in external diff tool'),self.vdifflocal),('edit',_('View at Revision'),None,'Alt+Ctrl+E',_('View file as it appeared at this revision'),self.editfile),('ledit',_('Edit Local'),None,'Shift+Ctrl+E',_('Edit current file in working copy'),self.editlocal),('revert',_('Revert to Revision'),None,'Alt+Ctrl+T',_('Revert file(s) to contents at this revision'),self.revertfile),]:act=QAction(desc,self)ificon:act.setIcon(geticon(icon))ifkey:act.setShortcut(key)iftip:act.setStatusTip(tip)ifcb:act.triggered.connect(cb)self._actions[name]=actself.addAction(act)defcontextMenuEvent(self,event):ifnotself.contextmenu:self.contextmenu=QMenu(self)foractin['diff','ldiff','edit','ledit','revert','navigate','diffnavigate']:ifact:self.contextmenu.addAction(self._actions[act])else:self.contextmenu.addSeparator()self.contextmenu.exec_(event.globalPos())defresizeEvent(self,event):ifself.model()isnotNone:vp_width=self.viewport().width()col_widths=[self.columnWidth(i) \
foriinrange(1,self.model().columnCount())]col_width=vp_width-sum(col_widths)col_width=max(col_width,50)self.setColumnWidth(0,col_width)QTableView.resizeEvent(self,event)defnextFile(self):row=self.currentIndex().row()self.setCurrentIndex(self.model().index(min(row+1,self.model().rowCount()-1),0))defprevFile(self):row=self.currentIndex().row()self.setCurrentIndex(self.model().index(max(row-1,0),0))### Mouse drag#defselectedRows(self):returnself.selectionModel().selectedRows()defdragObject(self):ctx=self.model()._ctxiftype(ctx.rev())==str:returnpaths=[]forindexinself.selectedRows():paths.append(self.model().fileFromIndex(index))ifnotpaths:returnifctx.rev()isNone:base=ctx._repo.rootelse:base,_=visdiff.snapshot(ctx._repo,paths,ctx)urls=[]forpathinpaths:u=QUrl()u.setPath('file://'+os.path.join(base,path))urls.append(u)ifurls:d=QDrag(self)m=QMimeData()m.setUrls(urls)d.setMimeData(m)d.start(Qt.CopyAction)defmousePressEvent(self,event):self.pressPos=event.pos()self.pressTime=QTime.currentTime()returnQTableView.mousePressEvent(self,event)defmouseMoveEvent(self,event):d=event.pos()-self.pressPosifd.manhattanLength()<QApplication.startDragDistance():returnQTableView.mouseMoveEvent(self,event)elapsed=self.pressTime.msecsTo(QTime.currentTime())ifelapsed<QApplication.startDragTime():returnQTableView.mouseMoveEvent(self,event)self.dragObject()returnQTableView.mouseMoveEvent(self,event)
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.