Patchwork [3,of,5] py3: make regexp patterns bytes in extdiff

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 17, 2018, 10:07 a.m.
Message ID <d21d2aee7b586eb509be.1518862058@mimosa>
Download mbox | patch
Permalink /patch/28023/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 17, 2018, 10:07 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1518858937 -32400
#      Sat Feb 17 18:15:37 2018 +0900
# Node ID d21d2aee7b586eb509bee6c8577efc00fed467f6
# Parent  c9ac00127748f7ba34ed4119d2802fba4945235a
py3: make regexp patterns bytes in extdiff

Patch

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -88,12 +88,12 @@  command = registrar.command(cmdtable)
 configtable = {}
 configitem = registrar.configitem(configtable)
 
-configitem('extdiff', r'opts\..*',
+configitem('extdiff', br'opts\..*',
     default='',
     generic=True,
 )
 
-configitem('diff-tools', r'.*\.diffargs$',
+configitem('diff-tools', br'.*\.diffargs$',
     default=None,
     generic=True,
 )
@@ -279,8 +279,8 @@  def dodiff(ui, repo, cmdline, pats, opts
             return pre + util.shellquote(replace[key])
 
         # Match parent2 first, so 'parent1?' will match both parent1 and parent
-        regex = (r'''(['"]?)([^\s'"$]*)'''
-                 r'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
+        regex = (br'''(['"]?)([^\s'"$]*)'''
+                 br'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
         if not do3way and not re.search(regex, cmdline):
             cmdline += ' $parent1 $child'
         cmdline = re.sub(regex, quote, cmdline)