changeset 41682: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 db69a763bc89
children c302218a2528
files mercurial/debugcommands.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Jan 31 15:35:51 2019 -0800
+++ b/mercurial/debugcommands.py	Sun Feb 10 14:04:08 2019 -0800
@@ -2474,15 +2474,15 @@
         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)