D2153: py3: open patches.queue in binary mode

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Feb 12 21:47:48 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbff95b002e33: py3: open patches.queue in binary mode (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2153?vs=5454&id=5578

REVISION DETAIL
  https://phab.mercurial-scm.org/D2153

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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:



To: indygreg, #hg-reviewers, pulkit, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list