Details
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHG25c543944bc0: py3: add b'' to regular expressions which are raw strings
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/mq.py (2 lines) | |||
M | mercurial/util.py (2 lines) |
def matchpatch(l): | def matchpatch(l): | ||||
l = l.split('#', 1)[0] | l = l.split('#', 1)[0] | ||||
return l.strip() == patch | return l.strip() == patch | ||||
for index, l in enumerate(self.fullseries): | for index, l in enumerate(self.fullseries): | ||||
if matchpatch(l): | if matchpatch(l): | ||||
return index | return index | ||||
return None | return None | ||||
guard_re = re.compile(r'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)') | guard_re = re.compile(br'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)') | ||||
def parseseries(self): | def parseseries(self): | ||||
self.series = [] | self.series = [] | ||||
self.seriesguards = [] | self.seriesguards = [] | ||||
for l in self.fullseries: | for l in self.fullseries: | ||||
h = l.find('#') | h = l.find('#') | ||||
if h == -1: | if h == -1: | ||||
patch = l | patch = l |
patterns = '|'.join(mapping.keys()) | patterns = '|'.join(mapping.keys()) | ||||
if escape_prefix: | if escape_prefix: | ||||
patterns += '|' + prefix | patterns += '|' + prefix | ||||
if len(prefix) > 1: | if len(prefix) > 1: | ||||
prefix_char = prefix[1:] | prefix_char = prefix[1:] | ||||
else: | else: | ||||
prefix_char = prefix | prefix_char = prefix | ||||
mapping[prefix_char] = prefix_char | mapping[prefix_char] = prefix_char | ||||
r = remod.compile(r'%s(%s)' % (prefix, patterns)) | r = remod.compile(br'%s(%s)' % (prefix, patterns)) | ||||
return r.sub(lambda x: fn(mapping[x.group()[1:]]), s) | return r.sub(lambda x: fn(mapping[x.group()[1:]]), s) | ||||
def getport(port): | def getport(port): | ||||
"""Return the port for a given network service. | """Return the port for a given network service. | ||||
If port is an integer, it's returned as is. If it's a string, it's | If port is an integer, it's returned as is. If it's a string, it's | ||||
looked up using socket.getservbyname(). If there's no matching | looked up using socket.getservbyname(). If there's no matching | ||||
service, error.Abort is raised. | service, error.Abort is raised. |