[PATCH 3 of 3] util: replace file I/O with readfile

Bryan O'Sullivan bos at serpentine.com
Tue Jan 12 18:21:03 CST 2016


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1452644179 28800
#      Tue Jan 12 16:16:19 2016 -0800
# Node ID 6200e4379675b401551c08e19f16f32f6f55e97c
# Parent  bdda0258d3884e81b9b80ca71669934d237be54c
util: replace file I/O with readfile

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -756,10 +756,7 @@ def tempfilter(s, cmd):
         if code:
             raise Abort(_("command '%s' failed: %s") %
                         (cmd, explainexit(code)))
-        fp = open(outname, 'rb')
-        r = fp.read()
-        fp.close()
-        return r
+        return readfile(outname)
     finally:
         try:
             if inname:


More information about the Mercurial-devel mailing list