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.
# treemodel.py - changelog viewer data model## Copyright 2008 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.''' Mercurial revision DAG visualization library Implements a gtk.TreeModel which visualizes a Mercurial repository revision history.Portions of this code stolen mercilessly from bzr-gtk visualizationdialog. Other portions stolen from graphlog extension.'''importgtkimportgobjectimportrefrommercurialimportutil,templatefiltersfromtortoisehg.utilimporthglibfromtortoisehg.hgtkimportgtklib# treemodel row enumerated attributesLINES=0# These elements come from the changelog walkerGRAPHNODE=1REVID=2LAST_LINES=3WFILE=4BRANCH=5# calculated on demand, not cachedHEXID=6LOCALTIME=7UTC=8MESSAGE=9# calculated on demand, cachedCOMMITER=10TAGS=11FGCOLOR=12AGE=13classTreeModel(gtk.GenericTreeModel):def__init__(self,repo,graphdata,opts):gtk.GenericTreeModel.__init__(self)self.repo=repoself.outgoing=opts['outgoing']self.origtip=opts['orig-tip']self.npreviews=opts['npreviews']self.showgraph=opts['show-graph']self.revisions={}self.graphdata=graphdataself.set_author_color()self.hidetags=self.repo.ui.config('tortoisehg','hidetags','').split()self.wcparents,self.tagrevs,self.branchtags=[],[],{}try: self.tagrevs = [repo[r].rev() for t, r in repo.tagslist()]
self.branchtags = repo.branchtags()
self.wcparents = [x.rev() for x in repo.parents()]
- except hglib.Abort:
+ except util.Abort:
pass
def refresh(self):
repo=self.repooldtags,oldparents=self.tagrevs,self.wcparentsoldbranches=[repo[n].rev()forninself.branchtags.values()]repo.invalidate()repo.dirstate.invalidate()self.wcparents=[x.rev()forxinrepo.parents()]self.tagrevs=[repo[r].rev()fort,rinrepo.tagslist()]self.branchtags=repo.branchtags()brevs=[repo[n].rev()forninself.branchtags.values()]allrevs=set(oldtags+oldparents+oldbranches+brevs+self.wcparents+self.tagrevs)forrevinallrevs:ifrevinself.revisions:delself.revisions[rev]defon_get_flags(self):returngtk.TREE_MODEL_LIST_ONLYdefon_get_n_columns(self):return13defon_get_column_type(self,index):ifindex==GRAPHNODE:returngobject.TYPE_PYOBJECTifindex==LINES:returngobject.TYPE_PYOBJECTifindex==REVID:returnintifindex==LAST_LINES:returngobject.TYPE_PYOBJECTifindex==WFILE:returnstrifindex==BRANCH:returnstrifindex==HEXID:returnstrifindex==LOCALTIME:returnstrifindex==UTC:returnstrifindex==MESSAGE:returnstrifindex==COMMITER:returnstrifindex==TAGS:returnstrifindex==FGCOLOR:returnstrifindex==AGE:returnstrdefon_get_iter(self,path):returnpath[0]defon_get_path(self,rowref):returnrowrefdefon_get_value(self,rowref,column):(revid,graphnode,lines,path)=self.graphdata[rowref]ifcolumn==REVID:returnrevidifcolumn==LINES:returnlinesifcolumn==LAST_LINES:ifrowref>0:returnself.graphdata[rowref-1][2]return[]ifcolumn==WFILE:returnpathor''ifcolumnin(HEXID,BRANCH,LOCALTIME,UTC):try:ctx=self.repo[revid]exceptIndexError:returnNoneifcolumn==HEXID:returnstr(ctx)ifcolumn==BRANCH:returnctx.branch()ifcolumn==LOCALTIME:returnhglib.displaytime(ctx.date())ifcolumn==UTC:returnhglib.utctime(ctx.date())ifrevidnotinself.revisions:try:ctx=self.repo[revid]exceptIndexError:returnNone# convert to Unicode for valid string operationssummary=hglib.tounicode(ctx.description()).replace(u'\0','')ifself.repo.ui.configbool('tortoisehg','longsummary'):limit=80lines=summary.splitlines()iflines:summary=lines.pop(0)whilelen(summary)<limitandlines:summary+=u' '+lines.pop(0)summary=summary[0:limit]else:summary=''else:lines=summary.splitlines()summary=linesandlines[0]or''summary=gtklib.markup_escape_text(hglib.toutf(summary))node=ctx.node()tags=self.repo.nodetags(node)taglist=hglib.toutf(', '.join(tags))tstr=''fortagintags:iftagnotinself.hidetags:tstr+='<span color="%s" background="%s"> %s </span> '% \
('black','#ffffaa',tag)branch=ctx.branch()bstr=''ifself.branchtags.get(branch)==node:bstr+='<span color="%s" background="%s"> %s </span> '% \
('black','#aaffaa',branch)author=hglib.toutf(hglib.username(ctx.user()))age=hglib.age(ctx.date())color=self.color_func(revid,author)ifrevidinself.wcparents:sumstr=bstr+tstr+'<b><u>'+summary+'</u></b>'status=4else:sumstr=bstr+tstr+summarystatus=0ifnodeinself.outgoing:# outgoingifnotself.showgraph:marker=hglib.toutf(u'\u2191 ')# up arrowsumstr=marker+sumstrstatus+=1elifrevid>=self.origtip:ifrevid>=len(self.repo)-self.npreviews:# incomingifnotself.showgraph:marker=hglib.toutf(u'\u2193 ')# down arrowsumstr=marker+sumstrstatus+=3else:# newstatus+=2revision=(sumstr,author,taglist,color,age,status)self.revisions[revid]=revisionelse:revision=self.revisions[revid]ifcolumn==GRAPHNODE:column,color=graphnodereturn(column,color,revision[5])else:returnrevision[column-MESSAGE]defon_iter_next(self,rowref):ifrowref<len(self.graphdata)-1:returnrowref+1returnNonedefon_iter_children(self,parent):ifparentisNone:return0returnNonedefon_iter_has_child(self,rowref):returnFalsedefon_iter_n_children(self,rowref):ifrowrefisNone:returnlen(self.graphdata)return0defon_iter_nth_child(self,parent,n):ifparentisNone:returnnreturnNonedefon_iter_parent(self,child):returnNonedefset_author_color(self):# If user has configured authorcolor in [tortoisehg], color# rows by author matchesself.author_pats=[]self.color_func=self.text_color_defaultifself.repoisnotNone:fork,vinself.repo.ui.configitems('tortoisehg'):ifnotk.startswith('authorcolor.'):continuepat=k[12:]self.author_pats.append((re.compile(pat,re.I),v))try:enabled=self.repo.ui.configbool('tortoisehg','authorcolor')excepthglib.ConfigError:enabled=Falseifself.author_patsorenabled:self.color_func=self.text_color_authordeftext_color_default(self,rev,author):returnint(rev)>=self.origtipand'darkgreen'or'black'colors='''black blue deeppink mediumorchid blue burlywood4 goldenrod slateblue red2 navy dimgrey'''.split()color_cache={}deftext_color_author(self,rev,author):ifint(rev)>=self.origtip:return'darkgreen'forre,vinself.author_pats:if(re.search(author)):returnvifauthornotinself.color_cache:color=self.colors[len(self.color_cache.keys())%len(self.colors)]self.color_cache[author]=colorreturnself.color_cache[author]
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.