Mercurial > public > mercurial-scm > hg-stable
diff mercurial/archival.py @ 17629:331d611813ec
Merge with crew-stable
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Wed, 19 Sep 2012 09:38:51 -0700 |
parents | 72fa4ef2245f 133d13e44544 |
children | 49ad7030ecc4 |
line wrap: on
line diff
--- a/mercurial/archival.py Tue Sep 18 21:39:12 2012 +0900 +++ b/mercurial/archival.py Wed Sep 19 09:38:51 2012 -0700 @@ -12,6 +12,7 @@ import scmutil, util, encoding import cStringIO, os, tarfile, time, zipfile import zlib, gzip +import struct # from unzip source code: _UNX_IFREG = 0x8000 @@ -169,6 +170,7 @@ if mtime < epoch: mtime = epoch + self.mtime = mtime self.date_time = time.gmtime(mtime)[:6] def addfile(self, name, mode, islink, data): @@ -182,6 +184,14 @@ mode = 0777 ftype = _UNX_IFLNK i.external_attr = (mode | ftype) << 16L + # add "extended-timestamp" extra block, because zip archives + # without this will be extracted with unexpected timestamp, + # if TZ is not configured as GMT + i.extra += struct.pack('<hhBl', + 0x5455, # block type: "extended-timestamp" + 1 + 4, # size of this block + 1, # "modification time is present" + self.mtime) # time of last modification (UTC) self.z.writestr(i, data) def done(self):