diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -13,6 +13,10 @@ import scmutil, util, encoding import cStringIO, os, tarfile, time, zipfile import zlib, gzip +# from unzip source code: +_UNX_IFREG = 0x8000 +_UNX_IFLNK = 0xa000 + def tidyprefix(dest, kind, prefix): '''choose prefix to use for names in archive. make sure prefix is safe for consumers.''' @@ -173,10 +177,10 @@ class zipit(object): # unzip will not honor unix file modes unless file creator is # set to unix (id 3). i.create_system = 3 - ftype = 0x8000 # UNX_IFREG in unzip source code + ftype = _UNX_IFREG if islink: mode = 0777 - ftype = 0xa000 # UNX_IFLNK in unzip source code + ftype = _UNX_IFLNK i.external_attr = (mode | ftype) << 16L self.z.writestr(i, data) diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -58,6 +58,8 @@ from i18n import _ _pack = struct.pack _unpack = struct.unpack +_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 @@ -207,7 +209,7 @@ class obsstore(object): # 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, 2) # os.SEEK_END + f.seek(0, _SEEK_END) offset = f.tell() transaction.add('obsstore', offset) # offset == 0: new file - add the version header diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py +++ b/mercurial/pure/osutil.py @@ -82,7 +82,7 @@ else: _FILE_ATTRIBUTE_NORMAL = 0x80 - # _open_osfhandle + # open_osfhandle flags _O_RDONLY = 0x0000 _O_RDWR = 0x0002 _O_APPEND = 0x0008