# HG changeset patch # User Mads Kiilerich # Date 1346102182 -7200 # Node ID 72fa4ef2245f83fd1e5b86bb43908b8ae6e50ee2 # Parent 72803c8edaa47a46628de71870a2f95a416e96cb declare local constants instead of using magic values and comments diff -r 72803c8edaa4 -r 72fa4ef2245f mercurial/archival.py --- a/mercurial/archival.py Mon Aug 27 23:14:27 2012 +0200 +++ b/mercurial/archival.py Mon Aug 27 23:16:22 2012 +0200 @@ -13,6 +13,10 @@ 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 @@ # 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 -r 72803c8edaa4 -r 72fa4ef2245f mercurial/obsolete.py --- a/mercurial/obsolete.py Mon Aug 27 23:14:27 2012 +0200 +++ b/mercurial/obsolete.py Mon Aug 27 23:16:22 2012 +0200 @@ -58,6 +58,8 @@ _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 @@ # 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 -r 72803c8edaa4 -r 72fa4ef2245f mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py Mon Aug 27 23:14:27 2012 +0200 +++ b/mercurial/pure/osutil.py Mon Aug 27 23:16:22 2012 +0200 @@ -82,7 +82,7 @@ _FILE_ATTRIBUTE_NORMAL = 0x80 - # _open_osfhandle + # open_osfhandle flags _O_RDONLY = 0x0000 _O_RDWR = 0x0002 _O_APPEND = 0x0008