changeset 23819:6bf93440a717

branchmap: add seek() to end of file before calling tell() on append open() This is similar to 48c232873a54, which was subsequently modified in 19f5dec2d61f for 2.4. Unexpected test changes on Windows occurred without this.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Jan 2015 12:00:03 -0500
parents 45c95e2f99ad
children 60178888be05
files mercurial/branchmap.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Fri Jan 09 22:14:01 2015 -0500
+++ b/mercurial/branchmap.py	Sat Jan 10 12:00:03 2015 -0500
@@ -407,6 +407,9 @@
             try:
                 if self._rbcnamescount != 0:
                     f = repo.vfs.open(_rbcnames, 'ab')
+                    # The position after open(x, 'a') is implementation defined-
+                    # see issue3543.  SEEK_END was added in 2.5
+                    f.seek(0, 2) #os.SEEK_END
                     if f.tell() == self._rbcsnameslen:
                         f.write('\0')
                     else:
@@ -431,6 +434,9 @@
                                    len(self._rbcrevs) // _rbcrecsize)
             try:
                 f = repo.vfs.open(_rbcrevs, 'ab')
+                # The position after open(x, 'a') is implementation defined-
+                # see issue3543.  SEEK_END was added in 2.5
+                f.seek(0, 2) #os.SEEK_END
                 if f.tell() != start:
                     f.seek(start)
                     f.truncate()