mercurial/util.py
changeset 14099 0824a0a3cefc
parent 14077 c285bdb0572a
child 14100 3e9e02a41dfb
--- a/mercurial/util.py	Sat Apr 30 18:30:14 2011 +0200
+++ b/mercurial/util.py	Sun May 01 11:46:49 2011 +0200
@@ -771,6 +771,20 @@
     makedirs(parent, mode)
     makedirs(name, mode)
 
+def readfile(path):
+    fp = open(path)
+    try:
+        return fp.read(size)
+    finally:
+        fp.close()
+
+def writefile(path, mode, text):
+    fp = open(path, mode)
+    try:
+        fp.write(text)
+    finally:
+        fp.close()
+
 class chunkbuffer(object):
     """Allow arbitrary sized chunks of data to be efficiently read from an
     iterator over chunks of arbitrary size."""