Mercurial > hg
comparison tests/test-archive.t @ 17628:133d13e44544 stable
archival: add "extended-timestamp" extra block for zip archives (issue3600)
Before this patch, zip archives created by "hg archive" are extracted
with unexpected timestamp, if TZ is not configured as GMT.
This patch adds "extended-timestamp" extra block to zip archives, and
unzip will extract such archives with timestamp specified in added
extra block, even though TZ is not configured as GMT.
Please see documents below for detail about specification of zip file
format and "extended-timestamp" extra block:
http://www.pkware.com/documents/casestudies/APPNOTE.TXT
http://www.opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra.fld
Original implementation of this patch was suggested by "Jun Omae
<jun66j5@gmail.com>".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 18 Sep 2012 19:46:15 +0900 |
parents | 953faba28e91 |
children | 331d611813ec |
comparison
equal
deleted
inserted
replaced
17601:6e2ab601be3f | 17628:133d13e44544 |
---|---|
268 *0*80*00:00*old/old (glob) | 268 *0*80*00:00*old/old (glob) |
269 *-----* (glob) | 269 *-----* (glob) |
270 \s*147\s+2 files (re) | 270 \s*147\s+2 files (re) |
271 | 271 |
272 $ cd .. | 272 $ cd .. |
273 | |
274 issue3600: check whether "hg archive" can create archive files which | |
275 are extracted with expected timestamp, even though TZ is not | |
276 configured as GMT. | |
277 | |
278 $ mkdir issue3600 | |
279 $ cd issue3600 | |
280 | |
281 $ hg init repo | |
282 $ echo a > repo/a | |
283 $ hg -R repo add repo/a | |
284 $ hg -R repo commit -m '#0' -d '456789012 21600' | |
285 $ cat > show_mtime.py <<EOF | |
286 > import sys, os | |
287 > print int(os.stat(sys.argv[1]).st_mtime) | |
288 > EOF | |
289 | |
290 $ hg -R repo archive --prefix tar-extracted archive.tar | |
291 $ (TZ=UTC-3; export TZ; tar xf archive.tar) | |
292 $ python show_mtime.py tar-extracted/a | |
293 456789012 | |
294 | |
295 $ hg -R repo archive --prefix zip-extracted archive.zip | |
296 $ (TZ=UTC-3; export TZ; unzip -q archive.zip) | |
297 $ python show_mtime.py zip-extracted/a | |
298 456789012 | |
299 | |
300 $ cd .. |