annotate tests/test-archive.t @ 18793:a821ec835223

completion: selectively use debugpathcomplete in bash_completion The current bash_completion code can be very slow in a large working directory. It always uses "hg status" to generate possibly matching files, which checks the status of every file. We often don't care about status when completing, so that cost is very high. As the new debugpathcomplete command does not check the status of files, it offers much better performance for commands that only care about completing names.
author Bryan O'Sullivan <bryano@fb.com>
date Thu, 21 Mar 2013 16:31:29 -0700
parents bb38f4f78104
children 88d1b59f6906
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
1 $ "$TESTDIR/hghave" serve || exit 80
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
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
15 $ echo "[web]" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
16 $ echo "name = test-archive" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
17 $ cp .hg/hgrc .hg/hgrc-base
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
18 > test_archtype() {
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
19 > echo "allow_archive = $1" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
20 > 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
21 > cat hg.pid >> $DAEMON_PIDS
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
22 > echo % $1 allowed should give 200
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 16920
diff changeset
23 > "$TESTDIR/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
24 > echo % $3 and $4 disallowed should both give 403
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 16920
diff changeset
25 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$3" | head -n 1
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 16920
diff changeset
26 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$4" | head -n 1
17466
d5a3bda6e170 killdaemons: take file argument explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
27 > "$TESTDIR/killdaemons.py" $DAEMON_PIDS
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
28 > cat errors.log
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
29 > cp .hg/hgrc-base .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
30 > }
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
31
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
32 check http return codes
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
33
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
34 $ test_archtype gz tar.gz tar.bz2 zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
35 % gz allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
36 200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
37 % tar.bz2 and zip disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
38 403 Archive type not allowed: bz2
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
39 403 Archive type not allowed: zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
40 $ test_archtype bz2 tar.bz2 zip tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
41 % bz2 allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
42 200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
43 % zip and tar.gz disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
44 403 Archive type not allowed: zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
45 403 Archive type not allowed: gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
46 $ test_archtype zip zip tar.gz tar.bz2
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
47 % zip allowed should give 200
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
48 200 Script output follows
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
49 % tar.gz and tar.bz2 disallowed should both give 403
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
50 403 Archive type not allowed: gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
51 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
52
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
53 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
54 $ 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
55 $ 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
56
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
57 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
58
17017
953faba28e91 tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 16920
diff changeset
59 $ "$TESTDIR/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
60 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
61
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
62 $ TIP=`hg id -v | cut -f1 -d' '`
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
63 $ QTIP=`hg id -q`
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
64 $ cat > getarchive.py <<EOF
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
65 > import os, sys, urllib2
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
66 > try:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
67 > # Set stdout to binary mode for win32 platforms
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
68 > import msvcrt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
69 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
70 > except ImportError:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
71 > pass
18770
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
72 > 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
73 > 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
74 > 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
75 > else:
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
76 > 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
77 > 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
78 > try:
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
79 > f = urllib2.urlopen('http://127.0.0.1:%s/?%s'
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
80 > % (os.environ['HGPORT'], requeststr))
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
81 > sys.stdout.write(f.read())
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
82 > except urllib2.HTTPError, e:
dcb6a99e82ff test-archive: gracefully handle HTTPErrors on get-with-headers
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 17743
diff changeset
83 > sys.stderr.write(str(e) + '\n')
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
84 > EOF
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
85 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
86 test-archive-2c0277f05ed4/.hg_archival.txt
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
87 test-archive-2c0277f05ed4/bar
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
88 test-archive-2c0277f05ed4/baz/bletch
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
89 test-archive-2c0277f05ed4/foo
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
90 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
91 test-archive-2c0277f05ed4/.hg_archival.txt
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
92 test-archive-2c0277f05ed4/bar
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
93 test-archive-2c0277f05ed4/baz/bletch
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
94 test-archive-2c0277f05ed4/foo
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
95 $ 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
96 $ unzip -t archive.zip
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
97 Archive: archive.zip
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
98 testing: test-archive-2c0277f05ed4/.hg_archival.txt OK
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
99 testing: test-archive-2c0277f05ed4/bar OK
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
100 testing: test-archive-2c0277f05ed4/baz/bletch OK
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
101 testing: test-archive-2c0277f05ed4/foo OK
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
102 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
103
18771
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
104 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
105
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
106 $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
107 test-archive-2c0277f05ed4/baz/bletch
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
108 $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
109 test-archive-2c0277f05ed4/foo
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
110
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
111 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
112
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
113 $ python getarchive.py "$TIP" gz relre:baz
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
114 HTTP Error 403: Archive pattern not allowed: relre:baz
bb38f4f78104 hgweb: teach archive how to download a specific directory or file
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18770
diff changeset
115
17466
d5a3bda6e170 killdaemons: take file argument explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 17017
diff changeset
116 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
7344
58fd3c718ca4 tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
117
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
118 $ hg archive -t tar test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
119 $ tar tf test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
120 test/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
121 test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
122 test/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
123 test/foo
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
124
16919
51932c835b74 archive: make progress only show files that are actually archived
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16350
diff changeset
125 $ hg archive --debug -t tbz2 -X baz test.tar.bz2
51932c835b74 archive: make progress only show files that are actually archived
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16350
diff changeset
126 archiving: 0/2 files (0.00%)
51932c835b74 archive: make progress only show files that are actually archived
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16350
diff changeset
127 archiving: bar 1/2 files (50.00%)
51932c835b74 archive: make progress only show files that are actually archived
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16350
diff changeset
128 archiving: foo 2/2 files (100.00%)
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
129 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
130 test/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
131 test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
132 test/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
133
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
134 $ 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
135 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
136 test-2c0277f05ed4/.hg_archival.txt
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
137 test-2c0277f05ed4/bar
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
138 test-2c0277f05ed4/baz/bletch
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
139 test-2c0277f05ed4/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
140
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
141 $ hg archive autodetected_test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
142 $ tar tf autodetected_test.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
143 autodetected_test/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
144 autodetected_test/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
145 autodetected_test/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
146 autodetected_test/foo
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
147
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
148 The '-t' should override autodetection
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
149
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
150 $ hg archive -t tar autodetect_override_test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
151 $ tar tf autodetect_override_test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
152 autodetect_override_test.zip/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
153 autodetect_override_test.zip/bar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
154 autodetect_override_test.zip/baz/bletch
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
155 autodetect_override_test.zip/foo
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
156
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
157 $ 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
158 > hg archive auto_test.$ext
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
159 > if [ -d auto_test.$ext ]; then
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
160 > echo "extension $ext was not autodetected."
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
161 > fi
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
162 > done
10650
9ea7238ad935 archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents: 10154
diff changeset
163
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
164 $ cat > md5comp.py <<EOF
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
165 > try:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
166 > from hashlib import md5
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
167 > except ImportError:
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
168 > from md5 import md5
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
169 > import sys
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
170 > f1, f2 = sys.argv[1:3]
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
171 > h1 = md5(file(f1, 'rb').read()).hexdigest()
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
172 > h2 = md5(file(f2, 'rb').read()).hexdigest()
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
173 > print h1 == h2 or "md5 differ: " + repr((h1, h2))
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
174 > EOF
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
175
13140
217ae7d5c8ee test-archive: whitespace cleanup
Martin Geisler <mg@aragost.com>
parents: 12398
diff changeset
176 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
177 rename them afterwards.
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
178
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
179 $ hg archive -t tgz tip.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
180 $ mv tip.tar.gz tip1.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
181 $ sleep 1
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
182 $ hg archive -t tgz tip.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
183 $ mv tip.tar.gz tip2.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
184 $ python md5comp.py tip1.tar.gz tip2.tar.gz
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
185 True
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
186
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
187 $ hg archive -t zip -p /illegal test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
188 abort: archive prefix contains illegal components
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11853
diff changeset
189 [255]
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
190 $ hg archive -t zip -p very/../bad test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
191
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
192 $ 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
193 $ unzip -t test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
194 Archive: test.zip
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
195 testing: test/bar OK
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
196 testing: test/baz/bletch OK
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
197 testing: test/foo OK
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
198 No errors detected in compressed data of test.zip.
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
199
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
200 $ hg archive -t tar - | tar tf - 2>/dev/null
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
201 test-2c0277f05ed4/.hg_archival.txt
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
202 test-2c0277f05ed4/bar
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
203 test-2c0277f05ed4/baz/bletch
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12339
diff changeset
204 test-2c0277f05ed4/foo
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
205
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
206 $ hg archive -r 0 -t tar rev-%r.tar
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
207 $ if [ -f rev-0.tar ]; then
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
208 $ fi
2476
0f7e4a39d9af archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2187
diff changeset
209
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
210 test .hg_archival.txt
4863
6dc0094c0827 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4805
diff changeset
211
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
212 $ hg archive ../test-tags
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
213 $ cat ../test-tags/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
214 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
215 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
216 branch: default
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
217 latesttag: null
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
218 latesttagdistance: 3
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
219 $ hg tag -r 2 mytag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
220 $ hg tag -r 2 anothertag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
221 $ hg archive -r 2 ../test-lasttag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
222 $ cat ../test-lasttag/.hg_archival.txt
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
223 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
224 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
225 branch: default
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
226 tag: anothertag
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
227 tag: mytag
5061
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
228
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
229 $ hg archive -t bogus test.bogus
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
230 abort: unknown archive type 'bogus'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11853
diff changeset
231 [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
232
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
233 enable progress extension:
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
234
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
235 $ cp $HGRCPATH $HGRCPATH.no-progress
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
236 $ cat >> $HGRCPATH <<EOF
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
237 > [extensions]
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
238 > progress =
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
239 > [progress]
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
240 > assume-tty = 1
13149
735dd8e8a208 progress using tests: disable time estimates to avoid flakiness
Augie Fackler <durin42@gmail.com>
parents: 13143
diff changeset
241 > format = topic bar number
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
242 > delay = 0
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
243 > refresh = 0
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
244 > width = 60
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
245 > EOF
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
246
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
247 $ 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
248 \r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
249 archiving [ ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
250 archiving [ ] 0/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
251 archiving [=========> ] 1/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
252 archiving [=========> ] 1/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
253 archiving [====================> ] 2/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
254 archiving [====================> ] 2/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
255 archiving [===============================> ] 3/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
256 archiving [===============================> ] 3/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
257 archiving [==========================================>] 4/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
258 archiving [==========================================>] 4/4\r (no-eol) (esc)
6047947afb6b tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup
Mads Kiilerich <mads@kiilerich.com>
parents: 17629
diff changeset
259 \r (no-eol) (esc)
13143
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
260
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
261 cleanup after progress extension test:
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
262
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
263 $ cp $HGRCPATH.no-progress $HGRCPATH
c2e55c21db27 archive: add support for progress extension
Martin Geisler <mg@aragost.com>
parents: 13140
diff changeset
264
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
265 server errors
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
266
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
267 $ cat errors.log
6019
b70a530bdb93 cleanly abort on unknown archive type (issue966)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
268
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
269 empty repo
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
270
11853
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
271 $ hg init ../empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
272 $ cd ../empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
273 $ hg archive ../test-empty
afe19a1bf9d3 tests: unify test-archive
Martin Geisler <mg@lazybytes.net>
parents: 10650
diff changeset
274 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
275 [255]
13140
217ae7d5c8ee test-archive: whitespace cleanup
Martin Geisler <mg@aragost.com>
parents: 12398
diff changeset
276
12321
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
277 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
278
12368
9581d5efb6a5 tests: fix touch -t with RHEL
Matt Mackall <mpm@selenic.com>
parents: 12367
diff changeset
279 $ touch -t 197501010000 old
12321
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
280 $ hg add old
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
281 $ hg commit -m old
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
282 $ hg archive ../old.zip
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
283 $ unzip -l ../old.zip
11db6fa2961e merge with stable
Martin Geisler <mg@aragost.com>
parents: 12319 12316
diff changeset
284 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
285 \s*Length.* (re)
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
286 *-----* (glob)
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
287 *147*80*00:00*old/.hg_archival.txt (glob)
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
288 *0*80*00:00*old/old (glob)
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
289 *-----* (glob)
12375
02990e22150b tests: require regexes in unified tests to be marked with " (re)"
Brodie Rao <brodie@bitheap.org>
parents: 12372
diff changeset
290 \s*147\s+2 files (re)
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
291
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
292 $ cd ..
17628
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
293
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
294 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
295 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
296 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
297
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
298 $ mkdir issue3600
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
299 $ cd issue3600
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
300
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
301 $ 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
302 $ 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
303 $ 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
304 $ 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
305 $ cat > show_mtime.py <<EOF
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
306 > import sys, os
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
307 > print int(os.stat(sys.argv[1]).st_mtime)
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
308 > EOF
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
309
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
310 $ 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
311 $ (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
312 $ 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
313 456789012
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
314
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
315 $ 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
316 $ (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
317 $ 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
318 456789012
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
319
133d13e44544 archival: add "extended-timestamp" extra block for zip archives (issue3600)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 17017
diff changeset
320 $ cd ..