mercurial/obsolete.py
changeset 17200 19f5dec2d61f
parent 17195 48c232873a54
child 17213 7eb5aa1f83fd
equal deleted inserted replaced
17199:c6e38fdff23c 17200:19f5dec2d61f
    49 - M bytes: metadata as a sequence of nul-terminated strings. Each
    49 - M bytes: metadata as a sequence of nul-terminated strings. Each
    50   string contains a key and a value, separated by a color ':', without
    50   string contains a key and a value, separated by a color ':', without
    51   additional encoding. Keys cannot contain '\0' or ':' and values
    51   additional encoding. Keys cannot contain '\0' or ':' and values
    52   cannot contain '\0'.
    52   cannot contain '\0'.
    53 """
    53 """
    54 import os, struct
    54 import struct
    55 from mercurial import util, base85
    55 from mercurial import util, base85
    56 from i18n import _
    56 from i18n import _
    57 
    57 
    58 _pack = struct.pack
    58 _pack = struct.pack
    59 _unpack = struct.unpack
    59 _unpack = struct.unpack
   198                 # Whether the file's current position is at the begin or at
   198                 # Whether the file's current position is at the begin or at
   199                 # the end after opening a file for appending is implementation
   199                 # the end after opening a file for appending is implementation
   200                 # defined. So we must seek to the end before calling tell(),
   200                 # defined. So we must seek to the end before calling tell(),
   201                 # or we may get a zero offset for non-zero sized files on
   201                 # or we may get a zero offset for non-zero sized files on
   202                 # some platforms (issue3543).
   202                 # some platforms (issue3543).
   203                 f.seek(0, os.SEEK_END)
   203                 f.seek(0, 2) # os.SEEK_END
   204                 offset = f.tell()
   204                 offset = f.tell()
   205                 transaction.add('obsstore', offset)
   205                 transaction.add('obsstore', offset)
   206                 if offset == 0:
   206                 if offset == 0:
   207                     # new file add version header
   207                     # new file add version header
   208                     f.write(_pack('>B', _fmversion))
   208                     f.write(_pack('>B', _fmversion))