comparison mercurial/commands.py @ 46688:7e02e7c721b0 stable

grep: convert an exception to bytes for a warning message Caught by pytype: File "/mnt/c/Users/Matt/hg/mercurial/commands.py", line 3457, in grep: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types] Expected: (self, ints: Iterable[int]) Actually passed: (self, ints: re.error) The following methods aren't implemented on re.error: __iter__ Differential Revision: https://phab.mercurial-scm.org/D10173
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 11 Mar 2021 17:16:29 -0500
parents ed43b6fa847e
children 184e0ae0a4b2
comparison
equal deleted inserted replaced
46687:83ffc49f7e48 46688:7e02e7c721b0
3442 reflags |= re.I 3442 reflags |= re.I
3443 try: 3443 try:
3444 regexp = util.re.compile(pattern, reflags) 3444 regexp = util.re.compile(pattern, reflags)
3445 except re.error as inst: 3445 except re.error as inst:
3446 ui.warn( 3446 ui.warn(
3447 _(b"grep: invalid match pattern: %s\n") % pycompat.bytestr(inst) 3447 _(b"grep: invalid match pattern: %s\n")
3448 % stringutil.forcebytestr(inst)
3448 ) 3449 )
3449 return 1 3450 return 1
3450 sep, eol = b':', b'\n' 3451 sep, eol = b':', b'\n'
3451 if opts.get(b'print0'): 3452 if opts.get(b'print0'):
3452 sep = eol = b'\0' 3453 sep = eol = b'\0'