D5020: py3: r'' prefix default values for mimetypes.guess_mime()
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Oct 12 17:49:29 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
As suggested by @yuja in https://phab.mercurial-scm.org/D4967.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5020
AFFECTED FILES
mercurial/hgweb/common.py
mercurial/hgweb/webcommands.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -151,7 +151,7 @@
if stringutil.binary(text):
mt = pycompat.sysbytes(
mimetypes.guess_type(pycompat.fsdecode(f))[0]
- or 'application/octet-stream')
+ or r'application/octet-stream')
text = '(binary:%s)' % mt
def lines(context):
@@ -864,7 +864,7 @@
if f.isbinary():
mt = pycompat.sysbytes(
mimetypes.guess_type(pycompat.fsdecode(f.path()))[0]
- or 'application/octet-stream')
+ or r'application/octet-stream')
return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))]
return f.data().splitlines()
@@ -952,7 +952,7 @@
if fctx.isbinary():
mt = pycompat.sysbytes(
mimetypes.guess_type(pycompat.fsdecode(fctx.path()))[0]
- or 'application/octet-stream')
+ or r'application/octet-stream')
lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()),
lineno=1, text='(binary:%s)' % mt)]
else:
diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -183,7 +183,7 @@
try:
os.stat(path)
ct = pycompat.sysbytes(
- mimetypes.guess_type(pycompat.fsdecode(path))[0] or "text/plain")
+ mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain")
with open(path, 'rb') as fh:
data = fh.read()
To: indygreg, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list