changeset 4801:16c1398b0063

python3: prefix all regex to work with python 2 and 3
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 06 Aug 2019 11:07:16 +0200
parents fa534a8c5863
children dc403312a012
files docs/test2rst.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/exthelper.py hgext3rd/evolve/obshistory.py hgext3rd/topic/__init__.py
diffstat 5 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/docs/test2rst.py	Tue Aug 06 00:16:05 2019 +0200
+++ b/docs/test2rst.py	Tue Aug 06 11:07:16 2019 +0200
@@ -14,10 +14,10 @@
 '''
 
 ignored_patterns = [
-    re.compile('^#if'),
-    re.compile('^#else'),
-    re.compile('^#endif'),
-    re.compile('#rest-ignore$'),
+    re.compile(r'^#if'),
+    re.compile(r'^#else'),
+    re.compile(r'^#endif'),
+    re.compile(r'#rest-ignore$'),
 ]
 
 
--- a/hgext3rd/evolve/evolvecmd.py	Tue Aug 06 00:16:05 2019 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Aug 06 11:07:16 2019 +0200
@@ -48,7 +48,7 @@
 shorttemplate = utility.shorttemplate
 stacktemplate = utility.stacktemplate
 _bookmarksupdater = rewriteutil.bookmarksupdater
-sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
+sha1re = re.compile(br'\b[0-9a-f]{6,40}\b')
 
 eh = exthelper.exthelper()
 mergetoolopts = commands.mergetoolopts
--- a/hgext3rd/evolve/exthelper.py	Tue Aug 06 00:16:05 2019 +0200
+++ b/hgext3rd/evolve/exthelper.py	Tue Aug 06 11:07:16 2019 +0200
@@ -88,7 +88,7 @@
 
             def _newdoregister(self, name, *args, **kwargs):
                 if kwargs.pop('helpbasic', False):
-                    name = '^' + name
+                    name = r'^' + name
                 return olddoregister(self, name, *args, **kwargs)
             self.command._doregister = _newdoregister
 
--- a/hgext3rd/evolve/obshistory.py	Tue Aug 06 00:16:05 2019 +0200
+++ b/hgext3rd/evolve/obshistory.py	Tue Aug 06 11:07:16 2019 +0200
@@ -766,11 +766,11 @@
 BRANCHCHANGED = 1 << 6 # the branch changed
 
 METABLACKLIST = [
-    re.compile('^__touch-noise__$'),
-    re.compile('^branch$'),
-    re.compile('^.*-source$'),
-    re.compile('^.*_source$'),
-    re.compile('^source$'),
+    re.compile(br'^__touch-noise__$'),
+    re.compile(br'^branch$'),
+    re.compile(br'^.*-source$'),
+    re.compile(br'^.*_source$'),
+    re.compile(br'^source$'),
 ]
 
 def ismetablacklisted(metaitem):
--- a/hgext3rd/topic/__init__.py	Tue Aug 06 00:16:05 2019 +0200
+++ b/hgext3rd/topic/__init__.py	Tue Aug 06 11:07:16 2019 +0200
@@ -264,8 +264,8 @@
         return None
 context.basectx.topicidx = _contexttopicidx
 
-stackrev = re.compile(r'^s\d+$')
-topicrev = re.compile(r'^t\d+$')
+stackrev = re.compile(br'^s\d+$')
+topicrev = re.compile(br'^t\d+$')
 
 hastopicext = common.hastopicext