comparison mercurial/graphmod.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
131 lambda rev: config.get(repo[rev].branch(), {}) 131 lambda rev: config.get(repo[rev].branch(), {})
132 ) 132 )
133 else: 133 else:
134 getconf = lambda rev: {} 134 getconf = lambda rev: {}
135 135
136 for cur, type, data, parents in dag: 136 for (cur, type, data, parents) in dag:
137
137 # Compute seen and next 138 # Compute seen and next
138 if cur not in seen: 139 if cur not in seen:
139 seen.append(cur) # new head 140 seen.append(cur) # new head
140 colors[cur] = newcolor 141 colors[cur] = newcolor
141 newcolor += 1 142 newcolor += 1
241 state.edges.pop(rev, None) 242 state.edges.pop(rev, None)
242 yield (type, char, width, (nodeidx, edges, ncols, nmorecols)) 243 yield (type, char, width, (nodeidx, edges, ncols, nmorecols))
243 244
244 245
245 def _fixlongrightedges(edges): 246 def _fixlongrightedges(edges):
246 for i, (start, end) in enumerate(edges): 247 for (i, (start, end)) in enumerate(edges):
247 if end > start: 248 if end > start:
248 edges[i] = (start, end + 1) 249 edges[i] = (start, end + 1)
249 250
250 251
251 def _getnodelineedgestail(echars, idx, pidx, ncols, coldiff, pdiff, fix_tail): 252 def _getnodelineedgestail(echars, idx, pidx, ncols, coldiff, pdiff, fix_tail):
262 remainder = ncols - idx - 1 263 remainder = ncols - idx - 1
263 return echars[-(remainder * 2) :] if remainder > 0 else [] 264 return echars[-(remainder * 2) :] if remainder > 0 else []
264 265
265 266
266 def _drawedges(echars, edges, nodeline, interline): 267 def _drawedges(echars, edges, nodeline, interline):
267 for start, end in edges: 268 for (start, end) in edges:
268 if start == end + 1: 269 if start == end + 1:
269 interline[2 * end + 1] = b"/" 270 interline[2 * end + 1] = b"/"
270 elif start == end - 1: 271 elif start == end - 1:
271 interline[2 * start + 1] = b"\\" 272 interline[2 * start + 1] = b"\\"
272 elif start == end: 273 elif start == end:
378 - graph data: list of { graph nodes/edges, text } 379 - graph data: list of { graph nodes/edges, text }
379 380
380 this function can be monkey-patched by extensions to alter graph display 381 this function can be monkey-patched by extensions to alter graph display
381 without needing to mimic all of the edge-fixup logic in ascii() 382 without needing to mimic all of the edge-fixup logic in ascii()
382 """ 383 """
383 for ln, logstr in graph: 384 for (ln, logstr) in graph:
384 ui.write((ln + logstr).rstrip() + b"\n") 385 ui.write((ln + logstr).rstrip() + b"\n")
385 386
386 387
387 def ascii(ui, state, type, char, text, coldata): 388 def ascii(ui, state, type, char, text, coldata):
388 """prints an ASCII graph of the DAG 389 """prints an ASCII graph of the DAG