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

login
register
mail settings
Submitter Matt Harbison
Date Feb. 6, 2015, 3:19 a.m.
Message ID <949d3f3f9a3f189cc80c.1423192756@Envy>
Download mbox | patch
Permalink /patch/7703/
State Accepted
Commit dc4fa3992414dbf379d2164d658546f847b52cf6
Headers show

Comments

Matt Harbison - Feb. 6, 2015, 3:19 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1422726875 18000
#      Sat Jan 31 12:54:35 2015 -0500
# Node ID 949d3f3f9a3f189cc80cc8d5e4e1e875c60bd59e
# Parent  46fe95366461159cb59b4380350255f2933d75ed
obsolete: drop the explicit seek to EOF after append mode open()

posixfile now handles this.
Matt Mackall - Feb. 6, 2015, 7:03 p.m.
On Thu, 2015-02-05 at 22:19 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1422726875 18000
> #      Sat Jan 31 12:54:35 2015 -0500
> # Node ID 949d3f3f9a3f189cc80cc8d5e4e1e875c60bd59e
> # Parent  46fe95366461159cb59b4380350255f2933d75ed
> obsolete: drop the explicit seek to EOF after append mode open()

These are queued for default, thanks.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -77,8 +77,6 @@ 
 _calcsize = struct.calcsize
 propertycache = util.propertycache
 
-_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
@@ -592,12 +590,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