comparison mercurial/hgweb/server.py @ 43551:313e3a279828

cleanup: remove pointless r-prefixes on double-quoted strings This is only double-quoted strings. I'll do single-quoted strings as a second step. These had existed because our source transformer didn't turn r"" into b"", so we had tagged some strings as r-strings to get "native" strings on both Pythons. Now that the transformer is gone, we can dispense with this nonsense. Methodology: I ran hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^a-z\]r\"\[\^\"\\\\\]\*\"\[\^\"\] in an emacs grep-mode buffer, and then used a keyboard macro to iterate over the results and remove the r prefix as needed. # skip-blame removing unneeded r prefixes left over from Python 3 migration. Differential Revision: https://phab.mercurial-scm.org/D7305
author Augie Fackler <augie@google.com>
date Thu, 07 Nov 2019 13:18:19 -0500
parents 92e24a139ecc
children 9f70512ae2cf
comparison
equal deleted inserted replaced
43550:c093cc6e6c99 43551:313e3a279828
60 def write(self, str): 60 def write(self, str):
61 self.writelines(str.split(b'\n')) 61 self.writelines(str.split(b'\n'))
62 62
63 def writelines(self, seq): 63 def writelines(self, seq):
64 for msg in seq: 64 for msg in seq:
65 self.handler.log_error(r"HG error: %s", encoding.strfromlocal(msg)) 65 self.handler.log_error("HG error: %s", encoding.strfromlocal(msg))
66 66
67 67
68 class _httprequesthandler(httpservermod.basehttprequesthandler): 68 class _httprequesthandler(httpservermod.basehttprequesthandler):
69 69
70 url_scheme = b'http' 70 url_scheme = b'http'
126 # exception first to ensure it is recorded. 126 # exception first to ensure it is recorded.
127 if not ( 127 if not (
128 isinstance(e, (OSError, socket.error)) 128 isinstance(e, (OSError, socket.error))
129 and e.errno == errno.ECONNRESET 129 and e.errno == errno.ECONNRESET
130 ): 130 ):
131 tb = r"".join(traceback.format_exception(*sys.exc_info())) 131 tb = "".join(traceback.format_exception(*sys.exc_info()))
132 # We need a native-string newline to poke in the log 132 # We need a native-string newline to poke in the log
133 # message, because we won't get a newline when using an 133 # message, because we won't get a newline when using an
134 # r-string. This is the easy way out. 134 # r-string. This is the easy way out.
135 newline = chr(10) 135 newline = chr(10)
136 self.log_error( 136 self.log_error(
137 r"Exception happened during processing " 137 r"Exception happened during processing "
138 r"request '%s':%s%s", 138 "request '%s':%s%s",
139 self.path, 139 self.path,
140 newline, 140 newline,
141 tb, 141 tb,
142 ) 142 )
143 143
144 self._start_response(r"500 Internal Server Error", []) 144 self._start_response("500 Internal Server Error", [])
145 self._write(b"Internal Server Error") 145 self._write(b"Internal Server Error")
146 self._done() 146 self._done()
147 147
148 def do_PUT(self): 148 def do_PUT(self):
149 self.do_POST() 149 self.do_POST()
333 requireclientcert=reqcert, 333 requireclientcert=reqcert,
334 ) 334 )
335 335
336 def setup(self): 336 def setup(self):
337 self.connection = self.request 337 self.connection = self.request
338 self.rfile = self.request.makefile(r"rb", self.rbufsize) 338 self.rfile = self.request.makefile("rb", self.rbufsize)
339 self.wfile = self.request.makefile(r"wb", self.wbufsize) 339 self.wfile = self.request.makefile("wb", self.wbufsize)
340 340
341 341
342 try: 342 try:
343 import threading 343 import threading
344 344