Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 41671:34ae00a14783
py3: use raw strings and %d for formatting
Before the string compares on Python 3 failed because we were
comparing bytes to str. Using raw strings ensures we are
always comparing str.
While we're here, also use %d to format integers.
Differential Revision: https://phab.mercurial-scm.org/D5925
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 10 Feb 2019 14:04:08 -0800 |
parents | ecf7f4ef52fb |
children | ea72da71ad69 |
comparison
equal
deleted
inserted
replaced
41670:db69a763bc89 | 41671:34ae00a14783 |
---|---|
2472 return 0 | 2472 return 0 |
2473 ui.write(('--- analyzed\n'), label='diff.file_a') | 2473 ui.write(('--- analyzed\n'), label='diff.file_a') |
2474 ui.write(('+++ optimized\n'), label='diff.file_b') | 2474 ui.write(('+++ optimized\n'), label='diff.file_b') |
2475 sm = difflib.SequenceMatcher(None, arevs, brevs) | 2475 sm = difflib.SequenceMatcher(None, arevs, brevs) |
2476 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | 2476 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
2477 if tag in ('delete', 'replace'): | 2477 if tag in (r'delete', r'replace'): |
2478 for c in arevs[alo:ahi]: | 2478 for c in arevs[alo:ahi]: |
2479 ui.write('-%s\n' % c, label='diff.deleted') | 2479 ui.write('-%d\n' % c, label='diff.deleted') |
2480 if tag in ('insert', 'replace'): | 2480 if tag in (r'insert', r'replace'): |
2481 for c in brevs[blo:bhi]: | 2481 for c in brevs[blo:bhi]: |
2482 ui.write('+%s\n' % c, label='diff.inserted') | 2482 ui.write('+%d\n' % c, label='diff.inserted') |
2483 if tag == 'equal': | 2483 if tag == r'equal': |
2484 for c in arevs[alo:ahi]: | 2484 for c in arevs[alo:ahi]: |
2485 ui.write(' %s\n' % c) | 2485 ui.write(' %d\n' % c) |
2486 return 1 | 2486 return 1 |
2487 | 2487 |
2488 func = revset.makematcher(tree) | 2488 func = revset.makematcher(tree) |
2489 revs = func(repo) | 2489 revs = func(repo) |
2490 if opts['show_set'] or (opts['show_set'] is None and ui.verbose): | 2490 if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |