Show More
@@ -13,6 +13,10 b' import scmutil, util, encoding' | |||
|
13 | 13 | import cStringIO, os, tarfile, time, zipfile |
|
14 | 14 | import zlib, gzip |
|
15 | 15 | |
|
16 | # from unzip source code: | |
|
17 | _UNX_IFREG = 0x8000 | |
|
18 | _UNX_IFLNK = 0xa000 | |
|
19 | ||
|
16 | 20 | def tidyprefix(dest, kind, prefix): |
|
17 | 21 | '''choose prefix to use for names in archive. make sure prefix is |
|
18 | 22 | safe for consumers.''' |
@@ -173,10 +177,10 b' class zipit(object):' | |||
|
173 | 177 | # unzip will not honor unix file modes unless file creator is |
|
174 | 178 | # set to unix (id 3). |
|
175 | 179 | i.create_system = 3 |
|
176 |
ftype = |
|
|
180 | ftype = _UNX_IFREG | |
|
177 | 181 | if islink: |
|
178 | 182 | mode = 0777 |
|
179 |
ftype = |
|
|
183 | ftype = _UNX_IFLNK | |
|
180 | 184 | i.external_attr = (mode | ftype) << 16L |
|
181 | 185 | self.z.writestr(i, data) |
|
182 | 186 |
@@ -58,6 +58,8 b' from i18n import _' | |||
|
58 | 58 | _pack = struct.pack |
|
59 | 59 | _unpack = struct.unpack |
|
60 | 60 | |
|
61 | _SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5 | |
|
62 | ||
|
61 | 63 | # the obsolete feature is not mature enough to be enabled by default. |
|
62 | 64 | # you have to rely on third party extension extension to enable this. |
|
63 | 65 | _enabled = False |
@@ -207,7 +209,7 b' class obsstore(object):' | |||
|
207 | 209 | # defined. So we must seek to the end before calling tell(), |
|
208 | 210 | # or we may get a zero offset for non-zero sized files on |
|
209 | 211 | # some platforms (issue3543). |
|
210 |
f.seek(0, |
|
|
212 | f.seek(0, _SEEK_END) | |
|
211 | 213 | offset = f.tell() |
|
212 | 214 | transaction.add('obsstore', offset) |
|
213 | 215 | # offset == 0: new file - add the version header |
General Comments 0
You need to be logged in to leave comments.
Login now