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.fromtortoisehg.utilimporthglib,patchctxfromtortoisehg.hgqt.qtlibimportgeticonfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*nullvariant=QVariant()classHgFileListModel(QAbstractTableModel):""" Model used for listing (modified) files of a given Hg revision """contextChanged=pyqtSignal(object)def__init__(self,repo,parent):""" data is a HgHLRepo instance """QAbstractTableModel.__init__(self,parent)self.repo=repoself._boldfont=parent.font()self._boldfont.setBold(True)self._ctx=Noneself._files=[]self._filesdict={}self._fulllist=Falseself._secondParent=False@pyqtSlot(bool)deftoggleFullFileList(self,value):self._fulllist=valueself.loadFiles()self.layoutChanged.emit()@pyqtSlot(bool)deftoggleSecondParent(self,value):self._secondParent=valueself.layoutChanged.emit()def__len__(self):returnlen(self._files)defrowCount(self,parent=None):returnlen(self)defcolumnCount(self,parent=None):return1deffile(self,row):returnself._files[row]['path']defsetContext(self,ctx):self.contextChanged.emit(ctx)reload=Falseifnotself._ctx:reload=Trueelifself._ctx.rev()isNone:reload=Trueelifctx.thgid()!=self._ctx.thgid():reload=Trueifreload:self._ctx=ctxself.loadFiles()self.layoutChanged.emit()deffileFromIndex(self,index):ifnotindex.isValid()orindex.row()>=len(self)ornotself._ctx:returnNonerow=index.row()returnself._files[row]['path']defrevFromIndex(self,index):'return revision for index. index is guarunteed to be valid'iflen(self._ctx.parents())<2:returnNonerow=index.row()data=self._files[row]if(data['wasmerged']andself._secondParent)or \
(data['parent']==1andself._fulllist):returnself._ctx.p2().rev()else:returnself._ctx.p1().rev()defdataFromIndex(self,index):ifnotindex.isValid()orindex.row()>=len(self)ornotself._ctx:returnNonerow=index.row()returnself._files[row]defindexFromFile(self,filename):iffilenameinself._filesdict:row=self._files.index(self._filesdict[filename])returnself.index(row,0)returnQModelIndex()def_buildDesc(self,parent):files=[]ctxfiles=self._ctx.files()modified,added,removed=self._ctx.changesToParent(parent)ismerge=bool(self._ctx.p2())# Add the list of modified subrepos to the top of the list if not isinstance(self._ctx, patchctx.patchctx):
if ".hgsubstate" in ctxfiles or ".hgsub" in ctxfiles:
from mercurial import subrepo
+ # Add the list of modified subrepos for s, sd in self._ctx.substate.items():
srev = self._ctx.substate.get(s, subrepo.nullstate)[1]
sp1rev = self._ctx.p1().substate.get(s, subrepo.nullstate)[1]
sp2rev=''ifismerge:sp2rev=self._ctx.p2().substate.get(s,subrepo.nullstate)[1] if srev != sp1rev or (sp2rev != '' and srev != sp2rev):
wasmerged = ismerge and s in ctxfiles
files.append({'path': s, 'status': 'S', 'parent': parent,
- 'wasmerged': wasmerged})+ 'wasmerged': wasmerged})
+ # Add the list of missing subrepos+ subreposet = set(self._ctx.substate.keys())+ subrepoparent1set = set(self._ctx.p1().substate.keys())+ missingsubreposet = subrepoparent1set.difference(subreposet)+ for s in missingsubreposet:+ wasmerged = ismerge and s in ctxfiles+ files.append({'path': s, 'status': 'S', 'parent': parent,+ 'wasmerged': wasmerged}) if self._fulllist and ismerge:
func = lambda x: True
else:func=lambdax:xinctxfilesforlst,flagin((added,'A'),(modified,'M'),(removed,'R')):forfinfilter(func,lst):wasmerged=ismergeandfinctxfilesfiles.append({'path':f,'status':flag,'parent':parent,'wasmerged':wasmerged})returnfilesdefloadFiles(self):self._files=[]self._files=self._buildDesc(0)ifbool(self._ctx.p2()):_paths=[x['path']forxinself._files]_files=self._buildDesc(1)self._files+=[xforxin_filesifx['path']notin_paths]self._filesdict=dict([(f['path'],f)forfinself._files])defdata(self,index,role):ifnotindex.isValid()orindex.row()>len(self)ornotself._ctx:returnnullvariantifindex.column()!=0:returnnullvariantrow=index.row()column=index.column()current_file_desc=self._files[row]current_file=current_file_desc['path']ifrolein(Qt.DisplayRole,Qt.ToolTipRole):returnQVariant(hglib.tounicode(current_file))elifrole==Qt.DecorationRole:ifself._fulllistandbool(self._ctx.p2()):ifcurrent_file_desc['wasmerged']:icn=geticon('thg-file-merged')elifcurrent_file_desc['parent']==0:icn=geticon('thg-file-p0')elifcurrent_file_desc['parent']==1:icn=geticon('thg-file-p1')returnQVariant(icn.pixmap(20,20))elifcurrent_file_desc['status']=='A':returnQVariant(geticon('fileadd'))elifcurrent_file_desc['status']=='R':returnQVariant(geticon('filedelete'))elifcurrent_file_desc['status']=='S':returnQVariant(geticon('hg'))#else:# return QVariant(geticon('filemodify'))elifrole==Qt.FontRole:ifcurrent_file_desc['wasmerged']:returnQVariant(self._boldfont)else:returnnullvariant
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.