Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 43117:8ff1ecfadcd1
cleanup: join string literals that are already on one line
Thanks to Kyle for noticing this and for providing the regular
expression to run on the codebase.
This patch has been reviewed by the test suite and they approved of
it.
# skip-blame: fallout from mass reformatting
Differential Revision: https://phab.mercurial-scm.org/D7028
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 08 Oct 2019 15:06:18 -0700 |
parents | d783f945a701 |
children | 70d42e2ad9b4 5be128f669d4 |
comparison
equal
deleted
inserted
replaced
43116:defabf63e969 | 43117:8ff1ecfadcd1 |
---|---|
2032 ) | 2032 ) |
2033 % c | 2033 % c |
2034 ) | 2034 ) |
2035 if ord(c) <= 31: | 2035 if ord(c) <= 31: |
2036 return _( | 2036 return _( |
2037 b"filename contains '%s', which is invalid " b"on Windows" | 2037 b"filename contains '%s', which is invalid on Windows" |
2038 ) % stringutil.escapestr(c) | 2038 ) % stringutil.escapestr(c) |
2039 base = n.split(b'.')[0] | 2039 base = n.split(b'.')[0] |
2040 if base and base.lower() in _winreservednames: | 2040 if base and base.lower() in _winreservednames: |
2041 return ( | 2041 return ( |
2042 _(b"filename contains '%s', which is reserved " b"on Windows") | 2042 _(b"filename contains '%s', which is reserved on Windows") |
2043 % base | 2043 % base |
2044 ) | 2044 ) |
2045 t = n[-1:] | 2045 t = n[-1:] |
2046 if t in b'. ' and n not in b'..': | 2046 if t in b'. ' and n not in b'..': |
2047 return ( | 2047 return ( |
3504 for f, s in pycompat.iteritems(map): | 3504 for f, s in pycompat.iteritems(map): |
3505 if s[0] != skip: | 3505 if s[0] != skip: |
3506 addpath(f) | 3506 addpath(f) |
3507 elif skip is not None: | 3507 elif skip is not None: |
3508 raise error.ProgrammingError( | 3508 raise error.ProgrammingError( |
3509 b"skip character is only supported " b"with a dict source" | 3509 b"skip character is only supported with a dict source" |
3510 ) | 3510 ) |
3511 else: | 3511 else: |
3512 for f in map: | 3512 for f in map: |
3513 addpath(f) | 3513 addpath(f) |
3514 | 3514 |
3581 def readexactly(stream, n): | 3581 def readexactly(stream, n): |
3582 '''read n bytes from stream.read and abort if less was available''' | 3582 '''read n bytes from stream.read and abort if less was available''' |
3583 s = stream.read(n) | 3583 s = stream.read(n) |
3584 if len(s) < n: | 3584 if len(s) < n: |
3585 raise error.Abort( | 3585 raise error.Abort( |
3586 _(b"stream ended unexpectedly" b" (got %d bytes, expected %d)") | 3586 _(b"stream ended unexpectedly (got %d bytes, expected %d)") |
3587 % (len(s), n) | 3587 % (len(s), n) |
3588 ) | 3588 ) |
3589 return s | 3589 return s |
3590 | 3590 |
3591 | 3591 |