py3: open patches.queue in binary mode
And switch to using the context manager form of open() while we're
here.
Differential Revision: https://phab.mercurial-scm.org/D2153
--- a/hgext/mq.py Sun Feb 11 15:55:47 2018 -0800
+++ b/hgext/mq.py Sun Feb 11 15:58:31 2018 -0800
@@ -445,9 +445,9 @@
def __init__(self, ui, baseui, path, patchdir=None):
self.basepath = path
try:
- fh = open(os.path.join(path, 'patches.queue'))
- cur = fh.read().rstrip()
- fh.close()
+ with open(os.path.join(path, 'patches.queue'), r'rb') as fh:
+ cur = fh.read().rstrip()
+
if not cur:
curpath = os.path.join(path, 'patches')
else: