Patchwork D2044: py3: use open() instead of file()

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2018, 8:23 a.m.
Message ID <differential-rev-PHID-DREV-kes7cogoae4ewzjmntl7-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27305/
State Superseded
Headers show

Comments

phabricator - Feb. 5, 2018, 8:23 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  file() is not present in Python 3

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -281,7 +281,7 @@ 
         nodeid = None
         diffstart = 0
 
-        for line in file(pf):
+        for line in open(pf, 'rb'):
             line = line.rstrip()
             if (line.startswith('diff --git')
                 or (diffstart and line.startswith('+++ '))):