tests/test-archive
author Henrik Stuart <henrik.stuart@edlund.dk>
Sat, 23 May 2009 17:02:49 +0200
changeset 8562 e3495c399006
parent 8296 908c5906091b
child 9614 58edd448da4f
permissions -rwxr-xr-x
named branches: server branchmap wire protocol support (issue736) The repository command, 'branchmap', returns a dictionary, branchname -> [branchheads], and will be implemented for localrepo, httprepo and sshrepo. The following wire format is used for returning data: branchname1 branch1head2 branch1head2 ... branchname2 ... ... Branch names are URL encoded to escape white space, and branch heads are sent as hex encoded node ids. All branches and all their heads are sent. The background and motivation for this command is the desire for a richer named branch semantics when pushing changesets. The details are explained in the original proposal which is included below. 1. BACKGROUND The algorithm currently implemented in Mercurial only considers the graph theoretical heads when determining whether new heads are created, rather than using the branch heads as a count (the algorithm considers a branch head effectively closed when it is merged into another branch or a new named branch is started from that point onward). Our particular problem with the algorithm is that we'd like to see the following case working without forcing a push: Upsteam has: (0:dev) ---- (1:dev) \ `--- (2:stable) Someone merges stable into dev: (0:dev) ---- (1:dev) ------(3:dev) \ / `--- (2:stable) --------´ This can be pushed without --force (as it should). Now someone else does some coding on stable (a bug fix, say): (0:dev) ---- (1:dev) ------(3:dev) \ / `--- (2:stable) ---------´---------(4:stable) This time we need --force to push. We allow this to be pushed without using --force by getting all the remote branch heads (by extending the wire protocol with a new function). We would, furthermore, also prefer if it is impossible to push a new branch without --force (or a later --newbranch option so --force isn't shoe-horned into too many disparate functions, if need be), except of course in the case where the remote repository is empty. This is what our patches accomplish. 2. ALTERNATIVES We have, of course, considered some alternatives to reconstructing enough information to decide whether we are creating new remote branch heads, before we added the new wire protocol command. 2.1. LOOKUP ON REMOTE The main alternative is to use the information from remote.heads() and remote.lookup() to try to reconstruct enough graph information to decide whether we are creating new heads. This is not adequate as illustrated below. Remember that each lookup is typically a request-response pair over SSH or HTTP(S). If we have a simple repository at the remote end like this: (0:dev) ---- (1:dev) ---- (3:stable) \ `--- (2:dev) then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2] locally and want to create a new node, 4:dev, as a descendant from (1:dev), which should be OK as 1:dev is a branch head. If we do remote.lookup('dev') we will get [2]. Thus, we can get information about whether a branch exists on the remote server or not, but this does not solve our problem of figuring out whether we are creating new heads or not. Pushing 4:dev ought to be OK, since after the push, we still only have two heads on branch a. Using remote.lookup() and remote.heads() is thus not adequate to consistently decide whether we are creating new remote heads (e.g. in this situation the latter would never return 1:dev). 2.2. USING INCOMING TO RECONSTRUCT THE GRAPH An alternative would be to use information equivalent to hg incoming to get the full remote graph in addition to the local graph. To do this, we would have to get a changegroup(subset) bundle representing the remote end (which may be a substantial amount of data), getting the branch heads from an instantiated bundlerepository, deleting the bundle, and finally, we can compute the prepush logic. While this is backwards compatible, it will cause a possibly substantial slowdown of the push command as it first needs to pull in all changes. 3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION Currently, the commands incoming and pull, work based on the tip of a given branch if used with "-r branchname", making it hard to get all revisions of a certain branch only (if it has multiple heads). This can be solved by requesting the remote's branchheads and letting the revisions to be used with the command be these heads. This can be done by extending the commands with a new option, e.g.: hg pull -b branchname which will be turned into the equivalent of: hg pull -r branchhead1 -r branchhead2 -r branchhead3 We have a simple follow-up patch that can do this ready as well (although not submitted yet as it is pending the acceptance of the branch patch). 4. WRAP-UP We generally find that the branchmap wire protocol extension can provide better named branch support to Mercurial. Currently, some things, like the initial push scenario in this mail, are fairly counter-intuitive, and the more often you have to force push, the more it is likely you will get a lot of spurious and unnecessary merge nodes. Also, restricting incoming and pull to all changes on a branch rather than changes on the tip-most head would be a sensible extension to making named branches a first class citizen in Mercurial. Currently, named branches sometimes feel like a late-coming unwanted step-child. We have run it in a production environment for a while, with fewer multiple heads occurring in our repositories and fewer confused users as a result. Also, it fixes the long-standing issue 736. Co-contributor: Sune Foldager <cryo@cyanite.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/bin/sh
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
mkdir test
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
cd test
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
hg init
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
echo foo>foo
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
     7
hg commit -Am 1 -d '1 0'
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     8
echo bar>bar
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
     9
hg commit -Am 2 -d '2 0'
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    10
mkdir baz
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
echo bletch>baz/bletch
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    12
hg commit -Am 3 -d '1000000000 0'
1260
4603eef60237 hgweb: use ui:username rather than web:contact
mpm@selenic.com
parents: 1166
diff changeset
    13
echo "[web]" >> .hg/hgrc
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    14
echo "name = test-archive" >> .hg/hgrc
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    15
cp .hg/hgrc .hg/hgrc-base
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    16
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    17
# check http return codes
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    18
test_archtype() {
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    19
    echo "allow_archive = $1" >> .hg/hgrc
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    20
    hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    21
    cat hg.pid >> $DAEMON_PIDS
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    22
    echo % $1 allowed should give 200
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    23
    "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$2" | head -n 1
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    24
    echo % $3 and $4 disallowed should both give 403
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    25
    "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    26
    "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1
7344
58fd3c718ca4 tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
    27
    "$TESTDIR/killdaemons.py"
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    28
    cat errors.log
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    29
    cp .hg/hgrc-base .hg/hgrc
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    30
}
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    31
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    32
echo
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    33
test_archtype gz tar.gz tar.bz2 zip
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    34
test_archtype bz2 tar.bz2 zip tar.gz
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    35
test_archtype zip zip tar.gz tar.bz2
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    36
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    37
echo "allow_archive = gz bz2 zip" >> .hg/hgrc
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
    38
hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
2571
83cfd95eafb5 tests: add timeouts, make run-tests.py clean up dead daemon processes
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2500
diff changeset
    39
cat hg.pid >> $DAEMON_PIDS
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    40
7029
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    41
echo % invalid arch type should give 404
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    42
"$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.invalid" | head -n 1
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    43
echo
b84d27386285 hgweb: Respond with HTTP 403 for disabled archive types instead of 404
Rocco Rutte <pdmef@gmx.net>
parents: 6496
diff changeset
    44
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    45
TIP=`hg id -v | cut -f1 -d' '`
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    46
QTIP=`hg id -q`
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    47
cat > getarchive.py <<EOF
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5108
diff changeset
    48
import os, sys, urllib2
7080
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    49
try:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    50
    # Set stdout to binary mode for win32 platforms
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    51
    import msvcrt
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    52
    msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    53
except ImportError:
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    54
    pass
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7029
diff changeset
    55
    
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    56
node, archive = sys.argv[1:]
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5108
diff changeset
    57
f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 5108
diff changeset
    58
                    % (os.environ['HGPORT'], node, archive))
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    59
sys.stdout.write(f.read())
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    60
EOF
8145
0c2ba48415c8 test-archive: silence stupid messages from GNU tar
Matt Mackall <mpm@selenic.com>
parents: 7344
diff changeset
    61
http_proxy= python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
0c2ba48415c8 test-archive: silence stupid messages from GNU tar
Matt Mackall <mpm@selenic.com>
parents: 7344
diff changeset
    62
http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
1166
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    63
http_proxy= python getarchive.py "$TIP" zip > archive.zip
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    64
unzip -t archive.zip | sed "s/$QTIP/TIP/"
bd66294b7a9b Added test case for zip/gz/bz2 archive downloads.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    65
7344
58fd3c718ca4 tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
    66
"$TESTDIR/killdaemons.py"
58fd3c718ca4 tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
    67
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    68
hg archive -t tar test.tar
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    69
tar tf test.tar
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    70
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    71
hg archive -t tbz2 -X baz test.tar.bz2
8145
0c2ba48415c8 test-archive: silence stupid messages from GNU tar
Matt Mackall <mpm@selenic.com>
parents: 7344
diff changeset
    72
bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    73
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    74
hg archive -t tgz -p %b-%h test-%h.tar.gz
8145
0c2ba48415c8 test-archive: silence stupid messages from GNU tar
Matt Mackall <mpm@selenic.com>
parents: 7344
diff changeset
    75
gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    76
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    77
cat > md5comp.py <<EOF
8296
908c5906091b util: remove md5
Martin Geisler <mg@lazybytes.net>
parents: 8145
diff changeset
    78
try:
908c5906091b util: remove md5
Martin Geisler <mg@lazybytes.net>
parents: 8145
diff changeset
    79
    from hashlib import md5
908c5906091b util: remove md5
Martin Geisler <mg@lazybytes.net>
parents: 8145
diff changeset
    80
except ImportError:
908c5906091b util: remove md5
Martin Geisler <mg@lazybytes.net>
parents: 8145
diff changeset
    81
    from md5 import md5
6496
118720f857b9 python-2.6: md5 import in test-archive helper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6183
diff changeset
    82
import sys
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    83
f1, f2 = sys.argv[1:3]
6496
118720f857b9 python-2.6: md5 import in test-archive helper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6183
diff changeset
    84
h1 = md5(file(f1, 'rb').read()).hexdigest()
118720f857b9 python-2.6: md5 import in test-archive helper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6183
diff changeset
    85
h2 = md5(file(f2, 'rb').read()).hexdigest()
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    86
print h1 == h2 or "md5 differ: " + repr((h1, h2))
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    87
EOF
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    88
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    89
# archive name is stored in the archive, so create similar
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    90
# archives and rename them afterwards.
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    91
hg archive -t tgz tip.tar.gz
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    92
mv tip.tar.gz tip1.tar.gz
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    93
sleep 1
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    94
hg archive -t tgz tip.tar.gz
4805
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    95
mv tip.tar.gz tip2.tar.gz
beb774707c52 test-archive: stop checking md5 absolute values
Patrick Mezard <pmezard@gmail.com>
parents: 4653
diff changeset
    96
python md5comp.py tip1.tar.gz tip2.tar.gz
4653
ca023b63ba1f archive: test md5 consistency
Brendan Cully <brendan@kublai.com>
parents: 2571
diff changeset
    97
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    98
hg archive -t zip -p /illegal test.zip
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
    99
hg archive -t zip -p very/../bad test.zip
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
   100
6183
0750e4ba9d3d Add config option to disable putting .hg_archival.txt inside archives.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6020
diff changeset
   101
hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
2114
98cc126f9f3f update tests after changing archival code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1929
diff changeset
   102
unzip -t test.zip
2476
0f7e4a39d9af archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2187
diff changeset
   103
8145
0c2ba48415c8 test-archive: silence stupid messages from GNU tar
Matt Mackall <mpm@selenic.com>
parents: 7344
diff changeset
   104
hg archive -t tar - | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
4863
6dc0094c0827 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4805
diff changeset
   105
4836
0e2d0a78f81a archive: make the %r escape work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4805
diff changeset
   106
hg archive -r 0 -t tar rev-%r.tar
0e2d0a78f81a archive: make the %r escape work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4805
diff changeset
   107
if [ -f rev-0.tar ]; then
0e2d0a78f81a archive: make the %r escape work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4805
diff changeset
   108
    echo 'rev-0.tar created'
0e2d0a78f81a archive: make the %r escape work.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4805
diff changeset
   109
fi
5061
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   110
6019
b70a530bdb93 cleanly abort on unknown archive type (issue966)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   111
hg archive -t bogus test.bogus
b70a530bdb93 cleanly abort on unknown archive type (issue966)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   112
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   113
echo % server errors
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   114
cat errors.log
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   115
5061
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   116
echo '% empty repo'
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   117
hg init ../empty
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   118
cd ../empty
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   119
hg archive ../test-empty
5924
b8009718a211 better error reporting for hg serve errors in tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 5384
diff changeset
   120
5061
a49f2a4d5ff7 archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents: 4836
diff changeset
   121
exit 0