Mercurial > public > mercurial-scm > hg
comparison mercurial/graphmod.py @ 36180:34e850440271
py3: slice over bytes to prevent getting ascii values
Differential Revision: https://phab.mercurial-scm.org/D2256
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 14 Feb 2018 15:43:03 +0530 |
parents | 5e1d4ccab455 |
children | 24e517600b29 |
comparison
equal
deleted
inserted
replaced
36179:7e6aad95244f | 36180:34e850440271 |
---|---|
452 text.append("") | 452 text.append("") |
453 | 453 |
454 if any(len(char) > 1 for char in edgemap.values()): | 454 if any(len(char) > 1 for char in edgemap.values()): |
455 # limit drawing an edge to the first or last N lines of the current | 455 # limit drawing an edge to the first or last N lines of the current |
456 # section the rest of the edge is drawn like a parent line. | 456 # section the rest of the edge is drawn like a parent line. |
457 parent = state['styles'][PARENT][-1] | 457 parent = state['styles'][PARENT][-1:] |
458 def _drawgp(char, i): | 458 def _drawgp(char, i): |
459 # should a grandparent character be drawn for this line? | 459 # should a grandparent character be drawn for this line? |
460 if len(char) < 2: | 460 if len(char) < 2: |
461 return True | 461 return True |
462 num = int(char[:-1]) | 462 num = int(char[:-1]) |
463 # either skip first num lines or take last num lines, based on sign | 463 # either skip first num lines or take last num lines, based on sign |
464 return -num <= i if num < 0 else (len(lines) - i) <= num | 464 return -num <= i if num < 0 else (len(lines) - i) <= num |
465 for i, line in enumerate(lines): | 465 for i, line in enumerate(lines): |
466 line[:] = [c[-1] if _drawgp(c, i) else parent for c in line] | 466 line[:] = [c[-1:] if _drawgp(c, i) else parent for c in line] |
467 edgemap.update( | 467 edgemap.update( |
468 (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) | 468 (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) |
469 | 469 |
470 # print lines | 470 # print lines |
471 indentation_level = max(ncols, ncols + coldiff) | 471 indentation_level = max(ncols, ncols + coldiff) |