tests/test-archive.t
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 13 Oct 2016 12:50:27 +0200
changeset 30155 b7a966ce89ed
parent 29562 cda10ff3175a
child 30747 4259df518223
permissions -rw-r--r--
changelog: disable delta chains This patch disables delta chains on changelogs. After this patch, new entries on changelogs - including existing changelogs - will be stored as the fulltext of that data (likely compressed). No delta computation will be performed. An overview of delta chains and data justifying this change follows. Revlogs try to store entries as a delta against a previous entry (either a parent revision in the case of generaldelta or the previous physical revision when not using generaldelta). Most of the time this is the correct thing to do: it frequently results in less CPU usage and smaller storage. Delta chains are most effective when the base revision being deltad against is similar to the current data. This tends to occur naturally for manifests and file data, since only small parts of each tend to change with each revision. Changelogs, however, are a different story. Changelog entries represent changesets/commits. And unless commits in a repository are homogonous (same author, changing same files, similar commit messages, etc), a delta from one entry to the next tends to be relatively large compared to the size of the entry. This means that delta chains tend to be short. How short? Here is the full vs delta revision breakdown on some real world repos: Repo % Full % Delta Max Length hg 45.8 54.2 6 mozilla-central 42.4 57.6 8 mozilla-unified 42.5 57.5 17 pypy 46.1 53.9 6 python-zstandard 46.1 53.9 3 (I threw in python-zstandard as an example of a repo that is homogonous. It contains a small Python project with changes all from the same author.) Contrast this with the manifest revlog for these repos, where 99+% of revisions are deltas and delta chains run into the thousands. So delta chains aren't as useful on changelogs. But even a short delta chain may provide benefits. Let's measure that. Delta chains may require less CPU to read revisions if the CPU time spent reading smaller deltas is less than the CPU time used to decompress larger individual entries. We can measure this via `hg perfrevlog -c -d 1` to iterate a revlog to resolve each revision's fulltext. Here are the results of that command on a repo using delta chains in its changelog and on a repo without delta chains: hg (forward) ! wall 0.407008 comb 0.410000 user 0.410000 sys 0.000000 (best of 25) ! wall 0.390061 comb 0.390000 user 0.390000 sys 0.000000 (best of 26) hg (reverse) ! wall 0.515221 comb 0.520000 user 0.520000 sys 0.000000 (best of 19) ! wall 0.400018 comb 0.400000 user 0.390000 sys 0.010000 (best of 25) mozilla-central (forward) ! wall 4.508296 comb 4.490000 user 4.490000 sys 0.000000 (best of 3) ! wall 4.370222 comb 4.370000 user 4.350000 sys 0.020000 (best of 3) mozilla-central (reverse) ! wall 5.758995 comb 5.760000 user 5.720000 sys 0.040000 (best of 3) ! wall 4.346503 comb 4.340000 user 4.320000 sys 0.020000 (best of 3) mozilla-unified (forward) ! wall 4.957088 comb 4.950000 user 4.940000 sys 0.010000 (best of 3) ! wall 4.660528 comb 4.650000 user 4.630000 sys 0.020000 (best of 3) mozilla-unified (reverse) ! wall 6.119827 comb 6.110000 user 6.090000 sys 0.020000 (best of 3) ! wall 4.675136 comb 4.670000 user 4.670000 sys 0.000000 (best of 3) pypy (forward) ! wall 1.231122 comb 1.240000 user 1.230000 sys 0.010000 (best of 8) ! wall 1.164896 comb 1.160000 user 1.160000 sys 0.000000 (best of 9) pypy (reverse) ! wall 1.467049 comb 1.460000 user 1.460000 sys 0.000000 (best of 7) ! wall 1.160200 comb 1.170000 user 1.160000 sys 0.010000 (best of 9) The data clearly shows that it takes less wall and CPU time to resolve revisions when there are no delta chains in the changelogs, regardless of the direction of traversal. Furthermore, not using a delta chain means that fulltext resolution in reverse is as fast as iterating forward. So not using delta chains on the changelog is a clear CPU win for reading operations. An example of a user-visible operation showing this speed-up is revset evaluation. Here are results for `hg perfrevset 'author(gps) or author(mpm)'`: hg ! wall 1.655506 comb 1.660000 user 1.650000 sys 0.010000 (best of 6) ! wall 1.612723 comb 1.610000 user 1.600000 sys 0.010000 (best of 7) mozilla-central ! wall 17.629826 comb 17.640000 user 17.600000 sys 0.040000 (best of 3) ! wall 17.311033 comb 17.300000 user 17.260000 sys 0.040000 (best of 3) What about 00changelog.i size? Repo Delta Chains No Delta Chains hg 7,033,250 6,976,771 mozilla-central 82,978,748 81,574,623 mozilla-unified 88,112,349 86,702,162 pypy 20,740,699 20,659,741 The data shows that removing delta chains from the changelog makes the changelog smaller. Delta chains are also used during changegroup generation. This operation essentially converts a series of revisions to one large delta chain. And changegroup generation is smart: if the delta in the revlog matches what the changegroup is emitting, it will reuse the delta instead of recalculating it. We can measure the impact removing changelog delta chains has on changegroup generation via `hg perfchangegroupchangelog`: hg ! wall 1.589245 comb 1.590000 user 1.590000 sys 0.000000 (best of 7) ! wall 1.788060 comb 1.790000 user 1.790000 sys 0.000000 (best of 6) mozilla-central ! wall 17.382585 comb 17.380000 user 17.340000 sys 0.040000 (best of 3) ! wall 20.161357 comb 20.160000 user 20.120000 sys 0.040000 (best of 3) mozilla-unified ! wall 18.722839 comb 18.720000 user 18.680000 sys 0.040000 (best of 3) ! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3) pypy ! wall 4.828317 comb 4.830000 user 4.820000 sys 0.010000 (best of 3) ! wall 5.415455 comb 5.420000 user 5.410000 sys 0.010000 (best of 3) The data shows eliminating delta chains makes the changelog part of changegroup generation slower. This is expected since we now have to compute deltas for revisions where we could recycle the delta before. It is worth putting this regression into context of overall changegroup times. Here is the rough total CPU time spent in changegroup generation for various repos while using delta chains on the changelog: Repo CPU Time (s) CPU Time w/ compression hg 4.50 7.05 mozilla-central 111.1 222.0 pypy 28.68 75.5 Before compression, removing delta chains from the changegroup adds ~4.4% overhead to hg changegroup generation, 1.3% to mozilla-central, and 2.0% to pypy. When you factor in zlib compression, these percentages are roughly divided by 2. While the increased CPU usage for changegroup generation is unfortunate, I think it is acceptable because the percentage is small, server operators (those likely impacted most by this) have other mechanisms to mitigate CPU consumption (namely reducing zlib compression level and pre-generated clone bundles), and because there is room to optimize this in the future. For example, we could use the nullid as the base revision, effectively encoding the full revision for each entry in the changegroup. When doing this, `hg perfchangegroupchangelog` nearly halves: mozilla-unified ! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3) ! wall 11.196461 comb 11.200000 user 11.190000 sys 0.010000 (best of 3) This looks very promising as a future optimization opportunity. It's worth that the changes in test-acl.t to the changegroup part size. This is because revision 6 in the changegroup had a delta chain of length 2 before and after this patch the base revision is nullrev. When the base revision is nullrev, cg2packer.deltaparent() hardcodes the *previous* revision from the changegroup as the delta parent. This caused the delta in the changegroup to switch base revisions, the delta to change, and the size to change accordingly. While the size increased in this case, I think sizes will remain the same on average, as the delta base for changelog revisions doesn't matter too much (as this patch shows). So, I don't consider this a regression.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 19870
diff changeset
     1
#require serve
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
     2
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13149
diff changeset
     3
  $ hg init test
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     4
  $ cd test
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     5
  $ echo foo>foo
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     6
  $ hg commit -Am 1 -d '1 0'
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     7
  adding foo
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     8
  $ echo bar>bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
     9
  $ hg commit -Am 2 -d '2 0'
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    10
  adding bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    11
  $ mkdir baz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    12
  $ echo bletch>baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    13
  $ hg commit -Am 3 -d '1000000000 0'
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    14
  adding baz/bletch
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    15
  $ hg init subrepo
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    16
  $ touch subrepo/sub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    17
  $ hg -q -R subrepo ci -Am "init subrepo"
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    18
  $ echo "subrepo = subrepo" > .hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    19
  $ hg add .hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
    20
  $ hg ci -m "add subrepo"
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    21
  $ echo "[web]" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    22
  $ echo "name = test-archive" >> .hg/hgrc
23232
a0ccb66f344d hgweb: fix a crash when using web.archivesubrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 23231
diff changeset
    23
  $ echo "archivesubrepos = True" >> .hg/hgrc
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    24
  $ cp .hg/hgrc .hg/hgrc-base
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    25
  > test_archtype() {
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    26
  >     echo "allow_archive = $1" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    27
  >     hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    28
  >     cat hg.pid >> $DAEMON_PIDS
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    29
  >     echo % $1 allowed should give 200
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25125
diff changeset
    30
  >     get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    31
  >     echo % $3 and $4 disallowed should both give 403
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25125
diff changeset
    32
  >     get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25125
diff changeset
    33
  >     get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
25474
8c14f87bd0ae tests: drop DAEMON_PIDS from killdaemons calls
Matt Mackall <mpm@selenic.com>
parents: 25472
diff changeset
    34
  >     killdaemons.py
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    35
  >     cat errors.log
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    36
  >     cp .hg/hgrc-base .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    37
  > }
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    38
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    39
check http return codes
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    40
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    41
  $ test_archtype gz tar.gz tar.bz2 zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    42
  % gz allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    43
  200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    44
  % tar.bz2 and zip disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    45
  403 Archive type not allowed: bz2
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    46
  403 Archive type not allowed: zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    47
  $ test_archtype bz2 tar.bz2 zip tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    48
  % bz2 allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    49
  200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    50
  % zip and tar.gz disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    51
  403 Archive type not allowed: zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    52
  403 Archive type not allowed: gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    53
  $ test_archtype zip zip tar.gz tar.bz2
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    54
  % zip allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    55
  200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    56
  % tar.gz and tar.bz2 disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    57
  403 Archive type not allowed: gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    58
  403 Archive type not allowed: bz2
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    59
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    60
  $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    61
  $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    62
  $ cat hg.pid >> $DAEMON_PIDS
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    63
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    64
invalid arch type should give 404
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    65
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25125
diff changeset
    66
  $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    67
  404 Unsupported archive type: None
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    68
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    69
  $ TIP=`hg id -v | cut -f1 -d' '`
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    70
  $ QTIP=`hg id -q`
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    71
  $ cat > getarchive.py <<EOF
29179
ce1c6ab15807 tests: test-archive.t use absolute_import
timeless <timeless@mozdev.org>
parents: 29178
diff changeset
    72
  > from __future__ import absolute_import
ce1c6ab15807 tests: test-archive.t use absolute_import
timeless <timeless@mozdev.org>
parents: 29178
diff changeset
    73
  > import os
ce1c6ab15807 tests: test-archive.t use absolute_import
timeless <timeless@mozdev.org>
parents: 29178
diff changeset
    74
  > import sys
29183
6def44ab4769 tests: test-archive.t use mercurial.util for urllib compat
timeless <timeless@mozdev.org>
parents: 29182
diff changeset
    75
  > from mercurial import (
6def44ab4769 tests: test-archive.t use mercurial.util for urllib compat
timeless <timeless@mozdev.org>
parents: 29182
diff changeset
    76
  >     util,
6def44ab4769 tests: test-archive.t use mercurial.util for urllib compat
timeless <timeless@mozdev.org>
parents: 29182
diff changeset
    77
  > )
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    78
  > try:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    79
  >     # Set stdout to binary mode for win32 platforms
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    80
  >     import msvcrt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    81
  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    82
  > except ImportError:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
    83
  >     pass
18770
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    84
  > if len(sys.argv) <= 3:
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    85
  >     node, archive = sys.argv[1:]
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    86
  >     requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    87
  > else:
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    88
  >     node, archive, file = sys.argv[1:]
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    89
  >     requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    90
  > try:
29182
6c0b1d964537 tests: test-archive.t use sys.stdout.buffer for binary output in py3
timeless <timeless@mozdev.org>
parents: 29179
diff changeset
    91
  >     stdout = sys.stdout.buffer
6c0b1d964537 tests: test-archive.t use sys.stdout.buffer for binary output in py3
timeless <timeless@mozdev.org>
parents: 29179
diff changeset
    92
  > except AttributeError:
6c0b1d964537 tests: test-archive.t use sys.stdout.buffer for binary output in py3
timeless <timeless@mozdev.org>
parents: 29179
diff changeset
    93
  >     stdout = sys.stdout
6c0b1d964537 tests: test-archive.t use sys.stdout.buffer for binary output in py3
timeless <timeless@mozdev.org>
parents: 29179
diff changeset
    94
  > try:
29183
6def44ab4769 tests: test-archive.t use mercurial.util for urllib compat
timeless <timeless@mozdev.org>
parents: 29182
diff changeset
    95
  >     f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s'
18770
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    96
  >                     % (os.environ['HGPORT'], requeststr))
29182
6c0b1d964537 tests: test-archive.t use sys.stdout.buffer for binary output in py3
timeless <timeless@mozdev.org>
parents: 29179
diff changeset
    97
  >     stdout.write(f.read())
29183
6def44ab4769 tests: test-archive.t use mercurial.util for urllib compat
timeless <timeless@mozdev.org>
parents: 29182
diff changeset
    98
  > except util.urlerr.httperror as e:
18770
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
    99
  >     sys.stderr.write(str(e) + '\n')
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   100
  > EOF
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
   101
  $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   102
  test-archive-1701ef1f1510/.hg_archival.txt
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   103
  test-archive-1701ef1f1510/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   104
  test-archive-1701ef1f1510/.hgsubstate
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   105
  test-archive-1701ef1f1510/bar
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   106
  test-archive-1701ef1f1510/baz/bletch
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   107
  test-archive-1701ef1f1510/foo
23232
a0ccb66f344d hgweb: fix a crash when using web.archivesubrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 23231
diff changeset
   108
  test-archive-1701ef1f1510/subrepo/sub
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
   109
  $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   110
  test-archive-1701ef1f1510/.hg_archival.txt
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   111
  test-archive-1701ef1f1510/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   112
  test-archive-1701ef1f1510/.hgsubstate
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   113
  test-archive-1701ef1f1510/bar
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   114
  test-archive-1701ef1f1510/baz/bletch
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   115
  test-archive-1701ef1f1510/foo
23232
a0ccb66f344d hgweb: fix a crash when using web.archivesubrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 23231
diff changeset
   116
  test-archive-1701ef1f1510/subrepo/sub
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   117
  $ python getarchive.py "$TIP" zip > archive.zip
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
   118
  $ unzip -t archive.zip
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   119
  Archive:  archive.zip
29562
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   120
      testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   121
      testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   122
      testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   123
      testing: test-archive-1701ef1f1510/bar*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   124
      testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   125
      testing: test-archive-1701ef1f1510/foo*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   126
      testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   127
  No errors detected in compressed data of archive.zip.
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
   128
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   129
test that we can download single directories and files
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   130
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   131
  $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   132
  test-archive-1701ef1f1510/baz/bletch
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   133
  $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   134
  test-archive-1701ef1f1510/foo
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   135
18968
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   136
test that we detect file patterns that match no files
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   137
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   138
  $ python getarchive.py "$TIP" gz foobar
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   139
  HTTP Error 404: file(s) not found: foobar
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   140
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   141
test that we reject unsafe patterns
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   142
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   143
  $ python getarchive.py "$TIP" gz relre:baz
18968
7d2a7f8e9da4 hgweb: respond HTTP_NOT_FOUND when an archive request does not match any files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18967
diff changeset
   144
  HTTP Error 404: file(s) not found: relre:baz
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
   145
25474
8c14f87bd0ae tests: drop DAEMON_PIDS from killdaemons calls
Matt Mackall <mpm@selenic.com>
parents: 25472
diff changeset
   146
  $ killdaemons.py
7344
58fd3c718ca4 tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
   147
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   148
  $ hg archive -t tar test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   149
  $ tar tf test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   150
  test/.hg_archival.txt
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   151
  test/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   152
  test/.hgsubstate
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   153
  test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   154
  test/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   155
  test/foo
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   156
25125
bd625cd4e5e7 progress: get the extremely verbose output out of default debug
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23645
diff changeset
   157
  $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   158
  archiving: 0/4 files (0.00%)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   159
  archiving: .hgsub 1/4 files (25.00%)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   160
  archiving: .hgsubstate 2/4 files (50.00%)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   161
  archiving: bar 3/4 files (75.00%)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   162
  archiving: foo 4/4 files (100.00%)
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   163
  $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   164
  test/.hg_archival.txt
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   165
  test/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   166
  test/.hgsubstate
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   167
  test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   168
  test/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
   169
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   170
  $ hg archive -t tgz -p %b-%h test-%h.tar.gz
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
   171
  $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   172
  test-1701ef1f1510/.hg_archival.txt
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   173
  test-1701ef1f1510/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   174
  test-1701ef1f1510/.hgsubstate
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   175
  test-1701ef1f1510/bar
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   176
  test-1701ef1f1510/baz/bletch
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   177
  test-1701ef1f1510/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
   178
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   179
  $ hg archive autodetected_test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   180
  $ tar tf autodetected_test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   181
  autodetected_test/.hg_archival.txt
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   182
  autodetected_test/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   183
  autodetected_test/.hgsubstate
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   184
  autodetected_test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   185
  autodetected_test/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   186
  autodetected_test/foo
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
   187
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   188
The '-t' should override autodetection
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   189
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   190
  $ hg archive -t tar autodetect_override_test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   191
  $ tar tf autodetect_override_test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   192
  autodetect_override_test.zip/.hg_archival.txt
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   193
  autodetect_override_test.zip/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   194
  autodetect_override_test.zip/.hgsubstate
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   195
  autodetect_override_test.zip/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   196
  autodetect_override_test.zip/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   197
  autodetect_override_test.zip/foo
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
   198
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   199
  $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   200
  >     hg archive auto_test.$ext
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   201
  >     if [ -d auto_test.$ext ]; then
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   202
  >         echo "extension $ext was not autodetected."
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   203
  >     fi
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   204
  > done
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
   205
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   206
  $ cat > md5comp.py <<EOF
29177
df6b5c6d252a tests: test-archive.t use print_function
timeless <timeless@mozdev.org>
parents: 28597
diff changeset
   207
  > from __future__ import print_function
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   208
  > try:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   209
  >     from hashlib import md5
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   210
  > except ImportError:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   211
  >     from md5 import md5
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   212
  > import sys
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   213
  > f1, f2 = sys.argv[1:3]
29178
0fb2fddd00a3 tests: test-archive.t use open() instead of file() for py3 compat
timeless <timeless@mozdev.org>
parents: 29177
diff changeset
   214
  > h1 = md5(open(f1, 'rb').read()).hexdigest()
0fb2fddd00a3 tests: test-archive.t use open() instead of file() for py3 compat
timeless <timeless@mozdev.org>
parents: 29177
diff changeset
   215
  > h2 = md5(open(f2, 'rb').read()).hexdigest()
29177
df6b5c6d252a tests: test-archive.t use print_function
timeless <timeless@mozdev.org>
parents: 28597
diff changeset
   216
  > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   217
  > EOF
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   218
13140
217ae7d5c8ee test-archive: whitespace cleanup
Martin Geisler <mg@aragost.com>
parents: 12398
diff changeset
   219
archive name is stored in the archive, so create similar archives and
217ae7d5c8ee test-archive: whitespace cleanup
Martin Geisler <mg@aragost.com>
parents: 12398
diff changeset
   220
rename them afterwards.
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   221
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   222
  $ hg archive -t tgz tip.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   223
  $ mv tip.tar.gz tip1.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   224
  $ sleep 1
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   225
  $ hg archive -t tgz tip.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   226
  $ mv tip.tar.gz tip2.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   227
  $ python md5comp.py tip1.tar.gz tip2.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   228
  True
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
   229
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   230
  $ hg archive -t zip -p /illegal test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   231
  abort: archive prefix contains illegal components
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11853
diff changeset
   232
  [255]
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   233
  $ hg archive -t zip -p very/../bad test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   234
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   235
  $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   236
  $ unzip -t test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   237
  Archive:  test.zip
29562
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   238
      testing: test/bar*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   239
      testing: test/baz/bletch*OK (glob)
cda10ff3175a tests: glob whitespace between path and OK in unzip(1) output
Augie Fackler <augie@google.com>
parents: 29183
diff changeset
   240
      testing: test/foo*OK (glob)
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   241
  No errors detected in compressed data of test.zip.
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
   242
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
   243
  $ hg archive -t tar - | tar tf - 2>/dev/null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   244
  test-1701ef1f1510/.hg_archival.txt
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   245
  test-1701ef1f1510/.hgsub
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   246
  test-1701ef1f1510/.hgsubstate
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   247
  test-1701ef1f1510/bar
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   248
  test-1701ef1f1510/baz/bletch
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   249
  test-1701ef1f1510/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
   250
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   251
  $ hg archive -r 0 -t tar rev-%r.tar
19870
055d5b3f83b1 tests: fix void and invalid test in test-archive.t
Mads Kiilerich <madski@unity3d.com>
parents: 18968
diff changeset
   252
  $ [ -f rev-0.tar ]
2476
0f7e4a39d9af archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2187
diff changeset
   253
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   254
test .hg_archival.txt
4863
6dc0094c0827 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4805
diff changeset
   255
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   256
  $ hg archive ../test-tags
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   257
  $ cat ../test-tags/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   258
  repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   259
  node: 1701ef1f151069b8747038e93b5186bb43a47504
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   260
  branch: default
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   261
  latesttag: null
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   262
  latesttagdistance: 4
23645
242d11819c6c archive: store number of changes since latest tag as well
Siddharth Agarwal <sid0@fb.com>
parents: 23232
diff changeset
   263
  changessincelatesttag: 4
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   264
  $ hg tag -r 2 mytag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   265
  $ hg tag -r 2 anothertag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   266
  $ hg archive -r 2 ../test-lasttag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   267
  $ cat ../test-lasttag/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   268
  repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   269
  node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   270
  branch: default
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   271
  tag: anothertag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   272
  tag: mytag
5061
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   273
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   274
  $ hg archive -t bogus test.bogus
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   275
  abort: unknown archive type 'bogus'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11853
diff changeset
   276
  [255]
9614
58edd448da4f archive: add branch and tag informations to the .hg_archival.txt file
Gilles Moris <gilles.moris@free.fr>
parents: 8296
diff changeset
   277
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   278
enable progress extension:
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   279
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   280
  $ cp $HGRCPATH $HGRCPATH.no-progress
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   281
  $ cat >> $HGRCPATH <<EOF
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   282
  > [progress]
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   283
  > assume-tty = 1
13149
735dd8e8a208 progress using tests: disable time estimates to avoid flakiness
Augie Fackler <durin42@gmail.com>
parents: 13143
diff changeset
   284
  > format = topic bar number
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   285
  > delay = 0
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   286
  > refresh = 0
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   287
  > width = 60
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   288
  > EOF
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   289
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
   290
  $ hg archive ../with-progress
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
   291
  \r (no-eol) (esc)
23231
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   292
  archiving [                                           ] 0/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   293
  archiving [======>                                    ] 1/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   294
  archiving [=============>                             ] 2/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   295
  archiving [====================>                      ] 3/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   296
  archiving [===========================>               ] 4/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   297
  archiving [==================================>        ] 5/6\r (no-eol) (esc)
32dadb2637f4 tests: introduce a subrepository to test-archive.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 22046
diff changeset
   298
  archiving [==========================================>] 6/6\r (no-eol) (esc)
17743
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
   299
                                                              \r (no-eol) (esc)
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   300
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   301
cleanup after progress extension test:
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   302
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   303
  $ cp $HGRCPATH.no-progress $HGRCPATH
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
   304
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   305
server errors
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   306
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   307
  $ cat errors.log
6019
b70a530bdb93 cleanly abort on unknown archive type (issue966)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   308
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   309
empty repo
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   310
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   311
  $ hg init ../empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   312
  $ cd ../empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   313
  $ hg archive ../test-empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
   314
  abort: no working directory: please specify a revision
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11853
diff changeset
   315
  [255]
13140
217ae7d5c8ee test-archive: whitespace cleanup
Martin Geisler <mg@aragost.com>
parents: 12398
diff changeset
   316
12321
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   317
old file -- date clamped to 1980
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   318
12368
9581d5efb6a5 tests: fix touch -t with RHEL
Matt Mackall <mpm@selenic.com>
parents: 12367
diff changeset
   319
  $ touch -t 197501010000 old
12321
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   320
  $ hg add old
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   321
  $ hg commit -m old
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   322
  $ hg archive ../old.zip
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   323
  $ unzip -l ../old.zip
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
   324
  Archive:  ../old.zip
12375
02990e22150b tests: require regexes in unified tests to be marked with " (re)"
Brodie Rao <brodie@bitheap.org>
parents: 12372
diff changeset
   325
  \s*Length.* (re)
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   326
  *-----* (glob)
23645
242d11819c6c archive: store number of changes since latest tag as well
Siddharth Agarwal <sid0@fb.com>
parents: 23232
diff changeset
   327
  *172*80*00:00*old/.hg_archival.txt (glob)
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   328
  *0*80*00:00*old/old (glob)
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   329
  *-----* (glob)
23645
242d11819c6c archive: store number of changes since latest tag as well
Siddharth Agarwal <sid0@fb.com>
parents: 23232
diff changeset
   330
  \s*172\s+2 files (re)
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
   331
18967
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   332
show an error when a provided pattern matches no files
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   333
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   334
  $ hg archive -I file_that_does_not_exist.foo ../empty.zip
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   335
  abort: no files match the archive pattern
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   336
  [255]
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   337
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   338
  $ hg archive -X * ../empty.zip
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   339
  abort: no files match the archive pattern
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   340
  [255]
88d1b59f6906 archive: raise error.Abort if the file pattern matches no files
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18771
diff changeset
   341
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
   342
  $ cd ..
17628
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   343
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   344
issue3600: check whether "hg archive" can create archive files which
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   345
are extracted with expected timestamp, even though TZ is not
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   346
configured as GMT.
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   347
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   348
  $ mkdir issue3600
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   349
  $ cd issue3600
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   350
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   351
  $ hg init repo
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   352
  $ echo a > repo/a
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   353
  $ hg -R repo add repo/a
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   354
  $ hg -R repo commit -m '#0' -d '456789012 21600'
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   355
  $ cat > show_mtime.py <<EOF
29177
df6b5c6d252a tests: test-archive.t use print_function
timeless <timeless@mozdev.org>
parents: 28597
diff changeset
   356
  > from __future__ import print_function
17628
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   357
  > import sys, os
29177
df6b5c6d252a tests: test-archive.t use print_function
timeless <timeless@mozdev.org>
parents: 28597
diff changeset
   358
  > print(int(os.stat(sys.argv[1]).st_mtime))
17628
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   359
  > EOF
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   360
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   361
  $ hg -R repo archive --prefix tar-extracted archive.tar
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   362
  $ (TZ=UTC-3; export TZ; tar xf archive.tar)
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   363
  $ python show_mtime.py tar-extracted/a
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   364
  456789012
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   365
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   366
  $ hg -R repo archive --prefix zip-extracted archive.zip
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   367
  $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   368
  $ python show_mtime.py zip-extracted/a
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   369
  456789012
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   370
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
   371
  $ cd ..