Mercurial > hg
comparison mercurial/graphmod.py @ 32160:906da89821ce
py3: use list of bytes rather than bytestring while extending bytes into lists
Python 2:
>>> ls = []
>>> ls.extend(b'abc')
>>> ls
['a', 'b', 'c']
Python 3:
>>> ls = []
>>> ls.extend(b'abc')
>>> ls
[97, 98, 99]
So to make sure things work fine in Py3, this patch does:
>>> ls = []
>>> ls.extend([b'a', b'b', b'c'])
>>> ls
[b'a', b'b', b'c']
After this `hg log -G` works!
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 04 May 2017 04:38:20 +0530 |
parents | d0b9e9803caf |
children | 27932a76a88d |
comparison
equal
deleted
inserted
replaced
32159:0fd15522a848 | 32160:906da89821ce |
---|---|
271 # | | X | | X | | | 271 # | | X | | X | | |
272 # | |/ / | |/ / | 272 # | |/ / | |/ / |
273 # | | | | | | | 273 # | | | | | | |
274 line.extend(echars[idx * 2:(idx + 1) * 2]) | 274 line.extend(echars[idx * 2:(idx + 1) * 2]) |
275 else: | 275 else: |
276 line.extend(' ') | 276 line.extend([' ', ' ']) |
277 # all edges to the right of the current node | 277 # all edges to the right of the current node |
278 remainder = ncols - idx - 1 | 278 remainder = ncols - idx - 1 |
279 if remainder > 0: | 279 if remainder > 0: |
280 line.extend(echars[-(remainder * 2):]) | 280 line.extend(echars[-(remainder * 2):]) |
281 return line | 281 return line |
408 state['lastcoldiff'], fix_nodeline_tail)) | 408 state['lastcoldiff'], fix_nodeline_tail)) |
409 | 409 |
410 # shift_interline is the line containing the non-vertical | 410 # shift_interline is the line containing the non-vertical |
411 # edges between this entry and the next | 411 # edges between this entry and the next |
412 shift_interline = echars[:idx * 2] | 412 shift_interline = echars[:idx * 2] |
413 shift_interline.extend(' ' * (2 + coldiff)) | 413 for i in xrange(2 + coldiff): |
414 shift_interline.append(' ') | |
414 count = ncols - idx - 1 | 415 count = ncols - idx - 1 |
415 if coldiff == -1: | 416 if coldiff == -1: |
416 shift_interline.extend('/ ' * count) | 417 for i in xrange(count): |
418 shift_interline.extend(['/', ' ']) | |
417 elif coldiff == 0: | 419 elif coldiff == 0: |
418 shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) | 420 shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) |
419 else: | 421 else: |
420 shift_interline.extend(r'\ ' * count) | 422 for i in xrange(count): |
423 shift_interline.extend(['\\', ' ']) | |
421 | 424 |
422 # draw edges from the current node to its parents | 425 # draw edges from the current node to its parents |
423 _drawedges(echars, edges, nodeline, shift_interline) | 426 _drawedges(echars, edges, nodeline, shift_interline) |
424 | 427 |
425 # lines is the list of all graph lines to print | 428 # lines is the list of all graph lines to print |