# HG changeset patch # User Augie Fackler # Date 2017-03-03 18:25:30 # Node ID 150cd51257221fad5ccba5794e7a21837afba479 # Parent 27e3b66ec7c57409d2df04381458c9bebd4355d6 schemes: move re construction to module-level and python3-ify This makes the schemes extension load correctly in Python 3. diff --git a/hgext/schemes.py b/hgext/schemes.py --- a/hgext/schemes.py +++ b/hgext/schemes.py @@ -63,6 +63,7 @@ command = cmdutil.command(cmdtable) # 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 @@ class ShortRepository(object): 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