Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 37120:e7b517809ebc
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 24 Mar 2018 14:32:34 +0900 |
parents | 7ccc9b8aca4c |
children | 5be286db5fb5 |
comparison
equal
deleted
inserted
replaced
37119:7ccc9b8aca4c | 37120:e7b517809ebc |
---|---|
1526 if pycompat.sysplatform == 'OpenVMS' and code & 1: | 1526 if pycompat.sysplatform == 'OpenVMS' and code & 1: |
1527 code = 0 | 1527 code = 0 |
1528 if code: | 1528 if code: |
1529 raise error.Abort(_("command '%s' failed: %s") % | 1529 raise error.Abort(_("command '%s' failed: %s") % |
1530 (cmd, explainexit(code))) | 1530 (cmd, explainexit(code))) |
1531 return readfile(outname) | 1531 with open(outname, 'rb') as fp: |
1532 return fp.read() | |
1532 finally: | 1533 finally: |
1533 try: | 1534 try: |
1534 if inname: | 1535 if inname: |
1535 os.unlink(inname) | 1536 os.unlink(inname) |
1536 except OSError: | 1537 except OSError: |