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

Yuya Nishihara yuya at tcha.org
Sat Feb 17 05:07:38 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at 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

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)


More information about the Mercurial-devel mailing list