[PATCH 3 of 3] obsolete: drop the explicit seek to EOF after append mode open()

Matt Harbison mharbison72 at gmail.com
Tue Feb 3 21:49:40 CST 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1422726875 18000
#      Sat Jan 31 12:54:35 2015 -0500
# Node ID 405802ef09f46a809a1d40eafa238980fbe3c96d
# Parent  8df3c46c0c076748e9d0e54e536fd2ac06e465ac
obsolete: drop the explicit seek to EOF after append mode open()

The vfs layer now handles this.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -76,8 +76,6 @@
 _unpack = struct.unpack
 _calcsize = struct.calcsize
 
-_SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5
-
 # the obsolete feature is not mature enough to be enabled by default.
 # you have to rely on third party extension extension to enable this.
 _enabled = False
@@ -574,12 +572,6 @@
         if new:
             f = self.sopener('obsstore', 'ab')
             try:
-                # Whether the file's current position is at the begin or at
-                # the end after opening a file for appending is implementation
-                # defined. So we must seek to the end before calling tell(),
-                # or we may get a zero offset for non-zero sized files on
-                # some platforms (issue3543).
-                f.seek(0, _SEEK_END)
                 offset = f.tell()
                 transaction.add('obsstore', offset)
                 # offset == 0: new file - add the version header


More information about the Mercurial-devel mailing list