From patchwork Sun Mar 25 03:36:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,7] util: stop using readfile() in tempfilter() From: Yuya Nishihara X-Patchwork-Id: 29833 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 25 Mar 2018 12:36:17 +0900 # HG changeset patch # User Yuya Nishihara # Date 1521869554 -32400 # Sat Mar 24 14:32:34 2018 +0900 # Node ID dd177967cc70361c854ac5b59672c1c903a11c7c # Parent 4bd2d19ecff7aa5ce3ce695427a478b9d3be9ff1 util: stop using readfile() in tempfilter() To unblock code move to utils.*. It's merely two lines of very Pythonic code. No helper function should be needed. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1528,7 +1528,8 @@ def tempfilter(s, cmd): if code: raise error.Abort(_("command '%s' failed: %s") % (cmd, explainexit(code))) - return readfile(outname) + with open(outname, 'rb') as fp: + return fp.read() finally: try: if inname: