changeset 31181:150cd5125722

schemes: move re construction to module-level and python3-ify This makes the schemes extension load correctly in Python 3.
author Augie Fackler <raf@durin42.com>
date Fri, 03 Mar 2017 13:25:30 -0500
parents 27e3b66ec7c5
children 5660c45ecba6
files hgext/schemes.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/schemes.py	Fri Mar 03 13:29:50 2017 -0500
+++ b/hgext/schemes.py	Fri Mar 03 13:25:30 2017 -0500
@@ -63,6 +63,7 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+_partre = re.compile(r'\{(\d+)\}'.encode(u'latin1'))
 
 class ShortRepository(object):
     def __init__(self, url, scheme, templater):
@@ -70,7 +71,7 @@
         self.templater = templater
         self.url = url
         try:
-            self.parts = max(map(int, re.findall(r'\{(\d+)\}', self.url)))
+            self.parts = max(map(int, _partre.findall(self.url)))
         except ValueError:
             self.parts = 0