##// END OF EJS Templates
global: use raw strings for regular expressions with escapes...
Gregory Szorc -
r41673:bd3f03d8 default
parent child Browse files
Show More
@@ -190,7 +190,7 b' def blackbox(ui, repo, *revs, **opts):'
190 break
190 break
191
191
192 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
192 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
193 if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
193 if re.match(br'^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
194 count += 1
194 count += 1
195 output.append(line)
195 output.append(line)
196
196
@@ -58,7 +58,7 b' def _commit(orig, ui, repo, *pats, **opt'
58 if not k:
58 if not k:
59 msg = _("unable to parse '%s', keys can't be empty")
59 msg = _("unable to parse '%s', keys can't be empty")
60 raise error.Abort(msg % raw)
60 raise error.Abort(msg % raw)
61 if re.search('[^\w-]', k):
61 if re.search(br'[^\w-]', k):
62 msg = _("keys can only contain ascii letters, digits,"
62 msg = _("keys can only contain ascii letters, digits,"
63 " '_' and '-'")
63 " '_' and '-'")
64 raise error.Abort(msg)
64 raise error.Abort(msg)
@@ -122,7 +122,7 b' def createlog(ui, directory=None, root="'
122 re_31 = re.compile(b'----------------------------$')
122 re_31 = re.compile(b'----------------------------$')
123 re_32 = re.compile(b'======================================='
123 re_32 = re.compile(b'======================================='
124 b'======================================$')
124 b'======================================$')
125 re_50 = re.compile(b'revision ([\\d.]+)(\s+locked by:\s+.+;)?$')
125 re_50 = re.compile(br'revision ([\d.]+)(\s+locked by:\s+.+;)?$')
126 re_60 = re.compile(br'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);'
126 re_60 = re.compile(br'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);'
127 br'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?'
127 br'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?'
128 br'(\s+commitid:\s+([^;]+);)?'
128 br'(\s+commitid:\s+([^;]+);)?'
@@ -1181,7 +1181,7 b' class queue(object):'
1181 def makepatchname(self, title, fallbackname):
1181 def makepatchname(self, title, fallbackname):
1182 """Return a suitable filename for title, adding a suffix to make
1182 """Return a suitable filename for title, adding a suffix to make
1183 it unique in the existing list"""
1183 it unique in the existing list"""
1184 namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')
1184 namebase = re.sub(br'[\s\W_]+', b'_', title.lower()).strip(b'_')
1185 namebase = namebase[:75] # avoid too long name (issue5117)
1185 namebase = namebase[:75] # avoid too long name (issue5117)
1186 if namebase:
1186 if namebase:
1187 try:
1187 try:
@@ -255,9 +255,9 b' def getrepophid(repo):'
255 repo.ui.setconfig(b'phabricator', b'repophid', repophid)
255 repo.ui.setconfig(b'phabricator', b'repophid', repophid)
256 return repophid
256 return repophid
257
257
258 _differentialrevisiontagre = re.compile(b'\AD([1-9][0-9]*)\Z')
258 _differentialrevisiontagre = re.compile(br'\AD([1-9][0-9]*)\Z')
259 _differentialrevisiondescre = re.compile(
259 _differentialrevisiondescre = re.compile(
260 b'^Differential Revision:\s*(?P<url>(?:.*)D(?P<id>[1-9][0-9]*))$', re.M)
260 br'^Differential Revision:\s*(?P<url>(?:.*)D(?P<id>[1-9][0-9]*))$', re.M)
261
261
262 def getoldnodedrevmap(repo, nodelist):
262 def getoldnodedrevmap(repo, nodelist):
263 """find previous nodes that has been sent to Phabricator
263 """find previous nodes that has been sent to Phabricator
@@ -55,7 +55,7 b' DEFAULT_SECTIONS = ['
55 ('api', _('API Changes')),
55 ('api', _('API Changes')),
56 ]
56 ]
57
57
58 RE_DIRECTIVE = re.compile('^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$')
58 RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$')
59 RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b'
59 RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b'
60
60
61 BULLET_SECTION = _('Other Changes')
61 BULLET_SECTION = _('Other Changes')
@@ -484,7 +484,7 b' if pycompat.iswindows:'
484 w32effects = None
484 w32effects = None
485 else:
485 else:
486 origattr = csbi.wAttributes
486 origattr = csbi.wAttributes
487 ansire = re.compile(b'\033\[([^m]*)m([^\033]*)(.*)',
487 ansire = re.compile(br'\033\[([^m]*)m([^\033]*)(.*)',
488 re.MULTILINE | re.DOTALL)
488 re.MULTILINE | re.DOTALL)
489
489
490 def win32print(ui, writefunc, text, **opts):
490 def win32print(ui, writefunc, text, **opts):
@@ -638,8 +638,8 b' class repobackend(abstractbackend):'
638 return self.changed | self.removed
638 return self.changed | self.removed
639
639
640 # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1
640 # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1
641 unidesc = re.compile('@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@')
641 unidesc = re.compile(br'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@')
642 contextdesc = re.compile('(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)')
642 contextdesc = re.compile(br'(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)')
643 eolmodes = ['strict', 'crlf', 'lf', 'auto']
643 eolmodes = ['strict', 'crlf', 'lf', 'auto']
644
644
645 class patchfile(object):
645 class patchfile(object):
@@ -2762,7 +2762,7 b' def diffstatsum(stats):'
2762 return maxfile, maxtotal, addtotal, removetotal, binary
2762 return maxfile, maxtotal, addtotal, removetotal, binary
2763
2763
2764 def diffstatdata(lines):
2764 def diffstatdata(lines):
2765 diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$')
2765 diffre = re.compile(br'^diff .*-r [a-z0-9]+\s(.*)$')
2766
2766
2767 results = []
2767 results = []
2768 filename, adds, removes, isbinary = None, 0, 0, False
2768 filename, adds, removes, isbinary = None, 0, 0, False
General Comments 0
You need to be logged in to leave comments. Login now