Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG34e850440271: py3: slice over bytes to prevent getting ascii values
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/graphmod.py (4 lines) | |||
M | mercurial/hgweb/webutil.py (2 lines) |
_drawendinglines(lines, extra_interline, edgemap, seen) | _drawendinglines(lines, extra_interline, edgemap, seen) | ||||
while len(text) < len(lines): | while len(text) < len(lines): | ||||
text.append("") | text.append("") | ||||
if any(len(char) > 1 for char in edgemap.values()): | if any(len(char) > 1 for char in edgemap.values()): | ||||
# limit drawing an edge to the first or last N lines of the current | # limit drawing an edge to the first or last N lines of the current | ||||
# section the rest of the edge is drawn like a parent line. | # section the rest of the edge is drawn like a parent line. | ||||
parent = state['styles'][PARENT][-1] | parent = state['styles'][PARENT][-1:] | ||||
def _drawgp(char, i): | def _drawgp(char, i): | ||||
# should a grandparent character be drawn for this line? | # should a grandparent character be drawn for this line? | ||||
if len(char) < 2: | if len(char) < 2: | ||||
return True | return True | ||||
num = int(char[:-1]) | num = int(char[:-1]) | ||||
# either skip first num lines or take last num lines, based on sign | # either skip first num lines or take last num lines, based on sign | ||||
return -num <= i if num < 0 else (len(lines) - i) <= num | return -num <= i if num < 0 else (len(lines) - i) <= num | ||||
for i, line in enumerate(lines): | for i, line in enumerate(lines): | ||||
line[:] = [c[-1] if _drawgp(c, i) else parent for c in line] | line[:] = [c[-1:] if _drawgp(c, i) else parent for c in line] | ||||
edgemap.update( | edgemap.update( | ||||
(e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) | (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) | ||||
# print lines | # print lines | ||||
indentation_level = max(ncols, ncols + coldiff) | indentation_level = max(ncols, ncols + coldiff) | ||||
for (line, logstr) in zip(lines, text): | for (line, logstr) in zip(lines, text): | ||||
ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) | ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) | ||||
ui.write(ln.rstrip() + '\n') | ui.write(ln.rstrip() + '\n') | ||||
# ... and start over | # ... and start over | ||||
state['lastcoldiff'] = coldiff | state['lastcoldiff'] = coldiff | ||||
state['lastindex'] = idx | state['lastindex'] = idx |
def getwebsubs(repo): | def getwebsubs(repo): | ||||
websubtable = [] | websubtable = [] | ||||
websubdefs = repo.ui.configitems('websub') | websubdefs = repo.ui.configitems('websub') | ||||
# we must maintain interhg backwards compatibility | # we must maintain interhg backwards compatibility | ||||
websubdefs += repo.ui.configitems('interhg') | websubdefs += repo.ui.configitems('interhg') | ||||
for key, pattern in websubdefs: | for key, pattern in websubdefs: | ||||
# grab the delimiter from the character after the "s" | # grab the delimiter from the character after the "s" | ||||
unesc = pattern[1] | unesc = pattern[1:2] | ||||
delim = re.escape(unesc) | delim = re.escape(unesc) | ||||
# identify portions of the pattern, taking care to avoid escaped | # identify portions of the pattern, taking care to avoid escaped | ||||
# delimiters. the replace format and flags are optional, but | # delimiters. the replace format and flags are optional, but | ||||
# delimiters are required. | # delimiters are required. | ||||
match = re.match( | match = re.match( | ||||
r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$' | r'^s%s(.+)(?:(?<=\\\\)|(?<!\\))%s(.*)%s([ilmsux])*$' | ||||
% (delim, delim, delim), pattern) | % (delim, delim, delim), pattern) |