--- a/mercurial/windows.py Thu Nov 20 12:15:12 2014 -0800
+++ b/mercurial/windows.py Sat Jan 31 12:39:44 2015 -0500
@@ -26,11 +26,19 @@
unlink = win32.unlink
umask = 0022
+_SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5
# wrap osutil.posixfile to provide friendlier exceptions
def posixfile(name, mode='r', buffering=-1):
try:
- return osutil.posixfile(name, mode, buffering)
+ fp = osutil.posixfile(name, mode, buffering)
+
+ # The position when opening in append mode is implementation defined, so
+ # make it consistent with other platforms, which position at EOF.
+ if 'a' in mode:
+ fp.seek(0, _SEEK_END)
+
+ return fp
except WindowsError, err:
raise IOError(err.errno, '%s: %s' % (name, err.strerror))
posixfile.__doc__ = osutil.posixfile.__doc__