# HG changeset patch # User Gregory Szorc # Date 2019-02-10 22:04:08 # Node ID 34ae00a147834ad7ce428b52e1169d82b6389082 # Parent db69a763bc893e06b1ae338ba9719c60970ecfe3 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 diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2474,15 +2474,15 @@ def debugrevspec(ui, repo, expr, **opts) ui.write(('+++ optimized\n'), label='diff.file_b') sm = difflib.SequenceMatcher(None, arevs, brevs) for tag, alo, ahi, blo, bhi in sm.get_opcodes(): - if tag in ('delete', 'replace'): + if tag in (r'delete', r'replace'): for c in arevs[alo:ahi]: - ui.write('-%s\n' % c, label='diff.deleted') - if tag in ('insert', 'replace'): + ui.write('-%d\n' % c, label='diff.deleted') + if tag in (r'insert', r'replace'): for c in brevs[blo:bhi]: - ui.write('+%s\n' % c, label='diff.inserted') - if tag == 'equal': + ui.write('+%d\n' % c, label='diff.inserted') + if tag == r'equal': for c in arevs[alo:ahi]: - ui.write(' %s\n' % c) + ui.write(' %d\n' % c) return 1 func = revset.makematcher(tree)