diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1483,6 +1483,7 @@ class atomictempfile(object): self._checkambig = checkambig # delegated methods + self.read = self._fp.read self.write = self._fp.write self.seek = self._fp.seek self.tell = self._fp.tell diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py --- a/tests/test-atomictempfile.py +++ b/tests/test-atomictempfile.py @@ -89,6 +89,13 @@ class testatomictempfile(unittest.TestCa # on other faster platforms can detect problems pass + def testread(self): + with open(self._filename, 'wb') as f: + f.write(b'foobar\n') + file = atomictempfile(self._filename, mode='rb') + self.assertTrue(file.read(), b'foobar\n') + file.discard() + if __name__ == '__main__': import silenttestrunner silenttestrunner.main(__name__)