diff 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
line wrap: on
line diff
--- a/tests/test-archive.t	Sun Sep 09 12:43:24 2012 -0400
+++ b/tests/test-archive.t	Tue Sep 18 19:46:15 2012 +0900
@@ -270,3 +270,31 @@
   \s*147\s+2 files (re)
 
   $ cd ..
+
+issue3600: check whether "hg archive" can create archive files which
+are extracted with expected timestamp, even though TZ is not
+configured as GMT.
+
+  $ mkdir issue3600
+  $ cd issue3600
+
+  $ hg init repo
+  $ echo a > repo/a
+  $ hg -R repo add repo/a
+  $ hg -R repo commit -m '#0' -d '456789012 21600'
+  $ cat > show_mtime.py <<EOF
+  > import sys, os
+  > print int(os.stat(sys.argv[1]).st_mtime)
+  > EOF
+
+  $ hg -R repo archive --prefix tar-extracted archive.tar
+  $ (TZ=UTC-3; export TZ; tar xf archive.tar)
+  $ python show_mtime.py tar-extracted/a
+  456789012
+
+  $ hg -R repo archive --prefix zip-extracted archive.zip
+  $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
+  $ python show_mtime.py zip-extracted/a
+  456789012
+
+  $ cd ..