fix appendfile problem on macos.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Mon, 27 Mar 2006 08:31:33 -0800
changeset 2010 db1eb0de286a
parent 2009 182f500805db
child 2011 b4df4687a78a
child 2013 65634e1038dd
child 2017 4c03bc02c779
fix appendfile problem on macos. when i open file with mode 'a+' on linux, seek position is 0. on macos seek position is end of file instead. not documented.
mercurial/appendfile.py
--- a/mercurial/appendfile.py	Sun Mar 26 22:54:05 2006 +0200
+++ b/mercurial/appendfile.py	Mon Mar 27 08:31:33 2006 -0800
@@ -37,7 +37,7 @@
         fd, self.tmpname = tempfile.mkstemp()
         self.tmpfp = os.fdopen(fd, 'ab+')
         self.realfp = fp
-        self.offset = 0
+        self.offset = fp.tell()
         # real file is not written by anyone else. cache its size so
         # seek and read can be fast.
         self.fpsize = os.fstat(fp.fileno()).st_size