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.
# chunkselect.py - Change chunk selection dialog## Copyright 2010 Steve Borho <steve@borho.org>## This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.importsysimportcStringIOfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*frommercurialimporthg,commands,util,cmdutil,mdiff,error,patchfromtortoisehg.utilimporthgshelve,hglibfromtortoisehg.util.i18nimport_fromtortoisehg.hgqt.htmllistviewimportHtmlListViewfromtortoisehg.hgqtimporthtmluidefcheck_max_diff(ctx,wfile):lines=[]try:fctx=ctx.filectx(wfile)size=fctx.size()except(EnvironmentError,error.LookupError):fctx=Noneiffctxandsize>hglib.getmaxdiffsize(ctx._repo.ui):# Fake patch that displays size warninglines=['diff --git a/%s b/%s\n'%(wfile,wfile)]lines.append(_('File is larger than the specified max size.\n'))lines.append(_('Hunk selection is disabled for this file.\n'))lines.append('--- a/%s\n'%wfile)lines.append('+++ b/%s\n'%wfile)eliffctxand'\0'infctx.data():# Fake patch that displays binary file warninglines=['diff --git a/%s b/%s\n'%(wfile,wfile)]lines.append(_('File is binary.\n'))lines.append(_('Hunk selection is disabled for this file.\n'))lines.append('--- a/%s\n'%wfile)lines.append('+++ b/%s\n'%wfile)returnlinesclassChunkModel(QAbstractListModel):def__init__(self,chunks):QAbstractTableModel.__init__(self)self.chunks=chunksdefrowCount(self,parent):ifnotparent.isValid():returnlen(self.chunks)return0defcolumnCount(self):return1defdata(self,index,role):ifnotindex.isValid()orrole!=Qt.DisplayRole:returnQVariant()ifindex.row()<0orindex.row()>=len(self.chunks):returnQVariant()returnQVariant(self.chunks[index.row()])defheaderData(self,col,orientation,role):ifcol!=0orrole!=Qt.DisplayRoleororientation!=Qt.Horizontal:returnQVariant()else:returnQVariant("Change chunks")defflags(self,index):returnQt.ItemIsSelectable|Qt.ItemIsEnableddefrun(ui,*pats,**opts): repo = hg.repository(ui)
fp = cStringIO.StringIO()
try:
- for p in repo[None].diff(opts={'git':True,'nodates':True}):
+ for p in repo[None].diff(git=True,nodates=True):
fp.write(p)
except (IOError, error.RepoError, error.LookupError, util.Abort), e:
print e
fp.seek(0)hu=htmlui.htmlui()items=[]forchunkinhgshelve.parsepatch(fp):ui.pushbuffer()chunk.write(ui)data=ui.popbuffer()fora,linpatch.difflabel(data.splitlines,True):hu.write(a,label=l)o,e=hu.getdata()items.append(o)cm=ChunkModel(items)lv=HtmlListView(cm)lv.show()returnlv
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.