Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 44021:6d3b67a837a6
cleanup: drop redundant character escapes from `[]` character sets
Flagged by PyCharm. Most special characters lose their special meaning inside
square brackets. The `-` in util.py doesn't need to be escaped because it is
the last character in the set.
Differential Revision: https://phab.mercurial-scm.org/D7766
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 28 Dec 2019 01:35:05 -0500 |
parents | e3ce3731d621 |
children | 5ac0e6f19eb4 |
comparison
equal
deleted
inserted
replaced
44020:ac3cb5e05a38 | 44021:6d3b67a837a6 |
---|---|
1624 # Sadly, the prompt string may have been built with a filename | 1624 # Sadly, the prompt string may have been built with a filename |
1625 # containing "$$" so let's try to find the first valid-looking | 1625 # containing "$$" so let's try to find the first valid-looking |
1626 # prompt to start parsing. Sadly, we also can't rely on | 1626 # prompt to start parsing. Sadly, we also can't rely on |
1627 # choices containing spaces, ASCII, or basically anything | 1627 # choices containing spaces, ASCII, or basically anything |
1628 # except an ampersand followed by a character. | 1628 # except an ampersand followed by a character. |
1629 m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt) | 1629 m = re.match(br'(?s)(.+?)\$\$([^$]*&[^ $].*)', prompt) |
1630 msg = m.group(1) | 1630 msg = m.group(1) |
1631 choices = [p.strip(b' ') for p in m.group(2).split(b'$$')] | 1631 choices = [p.strip(b' ') for p in m.group(2).split(b'$$')] |
1632 | 1632 |
1633 def choicetuple(s): | 1633 def choicetuple(s): |
1634 ampidx = s.index(b'&') | 1634 ampidx = s.index(b'&') |