comparison mercurial/cmdutil.py @ 28375:97cb1aeaca78

graphmod: refactor state handling Move ASCII graph state to a dictionary, to clarify what is being tracked. Move the 'seen' state (tracking currently active edges) into this structure.
author Martijn Pieters <mjpieters@fb.com>
date Fri, 04 Mar 2016 14:44:32 +0000
parents ebd0e86bdf89
children 3356bf61fa25
comparison
equal deleted inserted replaced
28374:af3bd9d1dbc1 28375:97cb1aeaca78
2210 return formatnode 2210 return formatnode
2211 2211
2212 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, 2212 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
2213 filematcher=None): 2213 filematcher=None):
2214 formatnode = _graphnodeformatter(ui, displayer) 2214 formatnode = _graphnodeformatter(ui, displayer)
2215 seen, state = [], graphmod.asciistate() 2215 state = graphmod.asciistate()
2216 for rev, type, ctx, parents in dag: 2216 for rev, type, ctx, parents in dag:
2217 char = formatnode(repo, ctx) 2217 char = formatnode(repo, ctx)
2218 copies = None 2218 copies = None
2219 if getrenamed and ctx.rev(): 2219 if getrenamed and ctx.rev():
2220 copies = [] 2220 copies = []
2228 displayer.show(ctx, copies=copies, matchfn=revmatchfn) 2228 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
2229 lines = displayer.hunk.pop(rev).split('\n') 2229 lines = displayer.hunk.pop(rev).split('\n')
2230 if not lines[-1]: 2230 if not lines[-1]:
2231 del lines[-1] 2231 del lines[-1]
2232 displayer.flush(ctx) 2232 displayer.flush(ctx)
2233 edges = edgefn(type, char, lines, seen, rev, parents) 2233 edges = edgefn(type, char, lines, state, rev, parents)
2234 for type, char, lines, coldata in edges: 2234 for type, char, lines, coldata in edges:
2235 graphmod.ascii(ui, state, type, char, lines, coldata) 2235 graphmod.ascii(ui, state, type, char, lines, coldata)
2236 displayer.close() 2236 displayer.close()
2237 2237
2238 def graphlog(ui, repo, *pats, **opts): 2238 def graphlog(ui, repo, *pats, **opts):