Show More
@@ -0,0 +1,32 b'' | |||
|
1 | #! /usr/bin/env python | |
|
2 | # | |
|
3 | # Based on python's Tools/scripts/md5sum.py | |
|
4 | # | |
|
5 | # This software may be used and distributed according to the terms | |
|
6 | # of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is | |
|
7 | # GPL-compatible. | |
|
8 | ||
|
9 | import sys | |
|
10 | import os | |
|
11 | import md5 | |
|
12 | ||
|
13 | for filename in sys.argv[1:]: | |
|
14 | try: | |
|
15 | fp = open(filename, 'rb') | |
|
16 | except IOError, msg: | |
|
17 | sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) | |
|
18 | sys.exit(1) | |
|
19 | ||
|
20 | m = md5.new() | |
|
21 | try: | |
|
22 | while 1: | |
|
23 | data = fp.read(8192) | |
|
24 | if not data: | |
|
25 | break | |
|
26 | m.update(data) | |
|
27 | except IOError, msg: | |
|
28 | sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) | |
|
29 | sys.exit(1) | |
|
30 | sys.stdout.write('%s %s\n' % (m.hexdigest(), filename)) | |
|
31 | ||
|
32 | sys.exit(0) |
@@ -1,148 +1,152 b'' | |||
|
1 | 1 | #!/bin/sh -e |
|
2 | 2 | |
|
3 | 3 | LANG="C"; export LANG |
|
4 | 4 | LC_CTYPE="C"; export LC_CTYPE |
|
5 | 5 | LC_NUMERIC="C"; export LC_NUMERIC |
|
6 | 6 | LC_TIME="C"; export LC_TIME |
|
7 | 7 | LC_COLLATE="C"; export LC_COLLATE |
|
8 | 8 | LC_MONETARY="C"; export LC_MONETARY |
|
9 | 9 | LC_MESSAGES="C"; export LC_MESSAGES |
|
10 | 10 | LC_PAPER="C"; export LC_PAPER |
|
11 | 11 | LC_NAME="C"; export LC_NAME |
|
12 | 12 | LC_ADDRESS="C"; export LC_ADDRESS |
|
13 | 13 | LC_TELEPHONE="C"; export LC_TELEPHONE |
|
14 | 14 | LC_MEASUREMENT="C"; export LC_MEASUREMENT |
|
15 | 15 | LC_IDENTIFICATION="C"; export LC_IDENTIFICATION |
|
16 | 16 | LC_ALL=""; export LC_ALL |
|
17 | 17 | TZ=GMT; export TZ |
|
18 | 18 | HGEDITOR=true; export HGEDITOR |
|
19 | 19 | HGMERGE=true; export HGMERGE |
|
20 | 20 | HGUSER="test"; export HGUSER |
|
21 | 21 | |
|
22 | ECHO_N="echo -n" | |
|
23 | [ -x /usr/ucb/echo ] && ECHO_N="/usr/ucb/echo -n" | |
|
24 | ||
|
22 | 25 | umask 022 |
|
23 | 26 | |
|
24 | 27 | tests=0 |
|
25 | 28 | failed=0 |
|
26 | 29 | |
|
27 | 30 | HGTMP="" |
|
28 | 31 | cleanup_exit() { |
|
29 | 32 | rm -rf "$HGTMP" |
|
30 | 33 | } |
|
31 | 34 | |
|
32 | 35 | # Remove temporary files even if we get interrupted |
|
33 | 36 | trap "cleanup_exit" 0 # normal exit |
|
34 | 37 | trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM |
|
35 | 38 | |
|
36 | 39 | HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$" |
|
37 | 40 | (umask 077 && mkdir "$HGTMP") || { |
|
38 | 41 | echo "Could not create temporary directory! Exiting." 1>&2 |
|
39 | 42 | exit 1 |
|
40 | 43 | } |
|
41 | 44 | |
|
42 | 45 | TESTDIR="$PWD" |
|
46 | export TESTDIR | |
|
43 | 47 | INST="$HGTMP/install" |
|
44 | 48 | PYTHONDIR="$INST/lib/python" |
|
45 | 49 | cd .. |
|
46 | 50 | if ${PYTHON-python} setup.py install --home="$INST" \ |
|
47 | 51 | --install-lib="$PYTHONDIR" > tests/install.err 2>&1 |
|
48 | 52 | then |
|
49 | 53 | rm tests/install.err |
|
50 | 54 | else |
|
51 | 55 | cat tests/install.err |
|
52 | 56 | exit 1 |
|
53 | 57 | fi |
|
54 | 58 | cd "$TESTDIR" |
|
55 | 59 | |
|
56 | 60 | BINDIR="$INST/bin" |
|
57 | 61 | PATH="$BINDIR:$PATH"; export PATH |
|
58 | 62 | if [ -n "$PYTHON" ]; then |
|
59 | 63 | { |
|
60 | 64 | echo "#!/bin/sh" |
|
61 | 65 | echo "exec \"$PYTHON"'" "$@"' |
|
62 | 66 | } > "$BINDIR/python" |
|
63 | 67 | chmod 755 "$BINDIR/python" |
|
64 | 68 | fi |
|
65 | 69 | |
|
66 | 70 | PYTHONPATH="$PYTHONDIR"; export PYTHONPATH |
|
67 | 71 | |
|
68 | 72 | run_one() { |
|
69 | 73 | rm -f "$1.err" |
|
70 | 74 | |
|
71 | 75 | mkdir "$HGTMP/$1" |
|
72 | 76 | cd "$HGTMP/$1" |
|
73 | 77 | fail=0 |
|
74 | 78 | HOME="$HGTMP/$1"; export HOME |
|
75 | 79 | OUT="$HGTMP/$1.out" |
|
76 | 80 | OUTOK="$TESTDIR/$1.out" |
|
77 | 81 | ERR="$TESTDIR/$1.err" |
|
78 | 82 | |
|
79 | 83 | if "$TESTDIR/$1" > "$OUT" 2>&1; then |
|
80 | 84 | : no error |
|
81 | 85 | else |
|
82 | 86 | echo "$1 failed with error code $?" |
|
83 | 87 | fail=1 |
|
84 | 88 | fi |
|
85 | 89 | |
|
86 | 90 | if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then |
|
87 | 91 | cp "$OUT" "$ERR" |
|
88 | 92 | echo |
|
89 | 93 | echo "$1 generated unexpected output:" |
|
90 | 94 | cat "$ERR" |
|
91 | 95 | fail=1 |
|
92 | 96 | elif [ -r "$OUTOK" ]; then |
|
93 | 97 | if diff -u "$OUTOK" "$OUT" > /dev/null; then |
|
94 | 98 | : no differences |
|
95 | 99 | else |
|
96 | 100 | cp "$OUT" "$ERR" |
|
97 | 101 | echo |
|
98 | 102 | echo "$1 output changed:" |
|
99 | 103 | diff -u "$OUTOK" "$ERR" || true |
|
100 | 104 | fail=1 |
|
101 | 105 | fi |
|
102 | 106 | fi |
|
103 | 107 | |
|
104 | 108 | cd "$TESTDIR" |
|
105 | 109 | rm -f "$HGTMP/$1.out" |
|
106 | 110 | rm -rf "$HGTMP/$1" |
|
107 | 111 | return $fail |
|
108 | 112 | } |
|
109 | 113 | |
|
110 | 114 | # list of prerequisite programs |
|
111 | 115 | # stuff from coreutils (cat, rm, etc) are not tested |
|
112 |
prereqs="python merge diff grep unzip |
|
|
116 | prereqs="python merge diff grep unzip gunzip sed" | |
|
113 | 117 | missing='' |
|
114 | 118 | for pre in $prereqs ; do |
|
115 | 119 | if type $pre > /dev/null 2>&1 ; then |
|
116 | 120 | : prereq exists |
|
117 | 121 | else |
|
118 | 122 | missing="$pre $missing" |
|
119 | 123 | fi |
|
120 | 124 | done |
|
121 | 125 | |
|
122 | 126 | if [ "$missing" != '' ] ; then |
|
123 | 127 | echo "ERROR: the test suite needs some programs to execute correctly." |
|
124 | 128 | echo "The following programs are missing: " |
|
125 | 129 | for pre in $missing; do |
|
126 | 130 | echo " $pre" |
|
127 | 131 | done |
|
128 | 132 | exit 1 |
|
129 | 133 | fi |
|
130 | 134 | |
|
131 | 135 | TESTS="$*" |
|
132 | 136 | if [ -z "$TESTS" ] ; then |
|
133 | 137 | TESTS=`ls test-* | grep -v "[.~]"` |
|
134 | 138 | fi |
|
135 | 139 | |
|
136 | 140 | for f in $TESTS ; do |
|
137 | echo -n "." | |
|
141 | $ECHO_N "." | |
|
138 | 142 | run_one $f || failed=`expr $failed + 1` |
|
139 | 143 | tests=`expr $tests + 1` |
|
140 | 144 | done |
|
141 | 145 | |
|
142 | 146 | echo |
|
143 | 147 | echo "Ran $tests tests, $failed failed." |
|
144 | 148 | |
|
145 | 149 | if [ $failed -gt 0 ] ; then |
|
146 | 150 | exit 1 |
|
147 | 151 | fi |
|
148 | 152 | exit 0 |
@@ -1,37 +1,38 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | mkdir test |
|
4 | 4 | cd test |
|
5 | 5 | hg init |
|
6 | 6 | echo foo>foo |
|
7 | 7 | hg addremove |
|
8 | 8 | hg commit -m 1 |
|
9 | 9 | echo bar>bar |
|
10 | 10 | hg addremove |
|
11 | 11 | hg commit -m 2 |
|
12 | 12 | mkdir baz |
|
13 | 13 | echo bletch>baz/bletch |
|
14 | 14 | hg addremove |
|
15 | 15 | hg commit -m 3 |
|
16 | 16 | echo "[web]" >> .hg/hgrc |
|
17 | 17 | echo "name = test-archive" >> .hg/hgrc |
|
18 | 18 | echo "allowzip = true" >> .hg/hgrc |
|
19 | 19 | echo "allowgz = true" >> .hg/hgrc |
|
20 | 20 | echo "allowbz2 = true" >> .hg/hgrc |
|
21 | 21 | hg serve -p 20059 -d --pid-file=hg.pid |
|
22 | 22 | |
|
23 | 23 | TIP=`hg id -v | cut -f1 -d' '` |
|
24 | 24 | QTIP=`hg id -q` |
|
25 | 25 | cat > getarchive.py <<EOF |
|
26 | 26 | import sys, urllib2 |
|
27 | 27 | node, archive = sys.argv[1:] |
|
28 | 28 | f = urllib2.urlopen('http://127.0.0.1:20059/?cmd=archive;node=%s;type=%s' |
|
29 | 29 | % (node, archive)) |
|
30 | 30 | sys.stdout.write(f.read()) |
|
31 | 31 | EOF |
|
32 |
http_proxy= python getarchive.py "$TIP" gz | tar t |
|
|
33 |
http_proxy= python getarchive.py "$TIP" bz2 | tar t |
|
|
32 | http_proxy= python getarchive.py "$TIP" gz | gunzip -dc - | tar tf - | sed "s/$QTIP/TIP/" | |
|
33 | http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 -dc - | tar tf - | sed "s/$QTIP/TIP/" | |
|
34 | 34 | http_proxy= python getarchive.py "$TIP" zip > archive.zip |
|
35 | 35 | unzip -t archive.zip | sed "s/$QTIP/TIP/" |
|
36 | 36 | |
|
37 | 37 | kill `cat hg.pid` |
|
38 | sleep 1 # wait for server to scream and die |
@@ -1,25 +1,25 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg clone http://localhost:20059/ copy |
|
4 | 4 | echo $? |
|
5 | 5 | ls copy |
|
6 | 6 | |
|
7 | 7 | cat > dumb.py <<EOF |
|
8 | 8 | import BaseHTTPServer, SimpleHTTPServer, signal |
|
9 | 9 | |
|
10 | 10 | def run(server_class=BaseHTTPServer.HTTPServer, |
|
11 | 11 | handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): |
|
12 | 12 | server_address = ('localhost', 20059) |
|
13 | 13 | httpd = server_class(server_address, handler_class) |
|
14 | 14 | httpd.serve_forever() |
|
15 | 15 | |
|
16 | 16 | signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) |
|
17 | 17 | run() |
|
18 | 18 | EOF |
|
19 | 19 | |
|
20 | 20 | python dumb.py 2>/dev/null & |
|
21 | 21 | |
|
22 | hg clone http://localhost:20059/foo copy2 | |
|
22 | http_proxy= hg clone http://localhost:20059/foo copy2 | |
|
23 | 23 | echo $? |
|
24 | 24 | |
|
25 | 25 | kill $! |
@@ -1,27 +1,27 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | mkdir a |
|
4 | 4 | cd a |
|
5 | 5 | hg init |
|
6 | 6 | echo a > a |
|
7 | 7 | hg add a |
|
8 | 8 | hg commit -m test -d '0 0' |
|
9 | 9 | |
|
10 | 10 | # Default operation |
|
11 | 11 | hg clone . ../b |
|
12 | 12 | cd ../b |
|
13 | 13 | cat a |
|
14 | 14 | hg verify |
|
15 | 15 | |
|
16 | 16 | # No update |
|
17 | 17 | hg clone -U . ../c |
|
18 | 18 | cd ../c |
|
19 | cat a | |
|
19 | cat a 2>/dev/null || echo "a not present" | |
|
20 | 20 | hg verify |
|
21 | 21 | |
|
22 | 22 | # Default destination |
|
23 | 23 | mkdir ../d |
|
24 | 24 | cd ../d |
|
25 | 25 | hg clone ../a |
|
26 | 26 | cd a |
|
27 | 27 | hg cat a |
@@ -1,13 +1,13 b'' | |||
|
1 | 1 | a |
|
2 | 2 | checking changesets |
|
3 | 3 | checking manifests |
|
4 | 4 | crosschecking files in changesets and manifests |
|
5 | 5 | checking files |
|
6 | 6 | 1 files, 1 changesets, 1 total revisions |
|
7 | cat: a: No such file or directory | |
|
7 | a not present | |
|
8 | 8 | checking changesets |
|
9 | 9 | checking manifests |
|
10 | 10 | crosschecking files in changesets and manifests |
|
11 | 11 | checking files |
|
12 | 12 | 1 files, 1 changesets, 1 total revisions |
|
13 | 13 | a |
@@ -1,16 +1,16 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg init |
|
4 | 4 | echo "nothing" > a |
|
5 | 5 | hg add a |
|
6 | 6 | hg commit -m ancestor -d "0 0" |
|
7 | 7 | echo "something" > a |
|
8 | 8 | hg commit -m branch1 -d "0 0" |
|
9 | 9 | hg co 0 |
|
10 | 10 | echo "something else" > a |
|
11 | 11 | hg commit -m branch2 -d "0 0" |
|
12 | 12 | HGMERGE=merge; export HGMERGE |
|
13 | 13 | hg up -m 1 |
|
14 | 14 | hg id |
|
15 |
grep - |
|
|
15 | egrep -v ">>>|<<<" a | |
|
16 | 16 | hg status |
@@ -1,30 +1,30 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg init |
|
4 | 4 | echo a > a |
|
5 | 5 | hg add a |
|
6 | 6 | hg commit -m "1" -d "0 0" |
|
7 | 7 | hg status |
|
8 | 8 | hg copy a b |
|
9 | 9 | hg status |
|
10 | 10 | hg --debug commit -m "2" -d "0 0" |
|
11 | 11 | echo "we should see two history entries" |
|
12 | 12 | hg history -v |
|
13 | 13 | echo "we should see one log entry for a" |
|
14 | 14 | hg log a |
|
15 | 15 | echo "this should show a revision linked to changeset 0" |
|
16 | 16 | hg debugindex .hg/data/a.i |
|
17 | 17 | echo "we should see one log entry for b" |
|
18 | 18 | hg log b |
|
19 | 19 | echo "this should show a revision linked to changeset 1" |
|
20 | 20 | hg debugindex .hg/data/b.i |
|
21 | 21 | |
|
22 | 22 | echo "this should show the rename information in the metadata" |
|
23 |
hg debugdata .hg/data/b.d 0 | head - |
|
|
23 | hg debugdata .hg/data/b.d 0 | head -3 | tail -2 | |
|
24 | 24 | |
|
25 | md5sum .hg/data/b.d | |
|
25 | $TESTDIR/md5sum.py .hg/data/b.d | |
|
26 | 26 | hg cat b > bsum |
|
27 | md5sum bsum | |
|
27 | $TESTDIR/md5sum.py bsum | |
|
28 | 28 | hg cat a > asum |
|
29 | md5sum asum | |
|
29 | $TESTDIR/md5sum.py asum | |
|
30 | 30 | hg verify |
@@ -1,16 +1,16 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg init |
|
4 | 4 | echo 123 > a |
|
5 | 5 | hg add a |
|
6 | 6 | hg commit -m "first" -d "0 0" a |
|
7 | 7 | mkdir sub |
|
8 | 8 | echo 321 > sub/b |
|
9 | 9 | hg add sub/b |
|
10 | 10 | hg commit -m "second" -d "0 0" sub/b |
|
11 | 11 | cat sub/b |
|
12 | 12 | hg co 0 |
|
13 | cat sub/b | |
|
14 | ls sub | |
|
13 | cat sub/b 2>/dev/null || echo "sub/b not present" | |
|
14 | ls sub 2>/dev/null || echo "sub not present" | |
|
15 | 15 | |
|
16 | 16 | true |
@@ -1,3 +1,3 b'' | |||
|
1 | 1 | 321 |
|
2 | cat: sub/b: No such file or directory | |
|
3 | ls: sub: No such file or directory | |
|
2 | sub/b not present | |
|
3 | sub not present |
@@ -1,34 +1,34 b'' | |||
|
1 | 1 | #!/bin/sh -e |
|
2 | 2 | |
|
3 | 3 | umask 027 |
|
4 | 4 | mkdir test1 |
|
5 | 5 | cd test1 |
|
6 | 6 | |
|
7 | 7 | hg init |
|
8 | 8 | touch a b |
|
9 | 9 | hg add a b |
|
10 | 10 | hg ci -m "added a b" -d "0 0" |
|
11 | 11 | |
|
12 | 12 | cd .. |
|
13 | 13 | mkdir test2 |
|
14 | 14 | cd test2 |
|
15 | 15 | |
|
16 | 16 | hg init |
|
17 | 17 | hg pull ../test1 |
|
18 | 18 | hg co |
|
19 | 19 | chmod +x a |
|
20 | 20 | hg ci -m "chmod +x a" -d "0 0" |
|
21 | 21 | |
|
22 | 22 | cd ../test1 |
|
23 | 23 | echo 123 >>a |
|
24 | 24 | hg ci -m "a updated" -d "0 0" |
|
25 | 25 | |
|
26 | 26 | hg pull ../test2 |
|
27 | 27 | hg heads |
|
28 | 28 | hg history |
|
29 | 29 | |
|
30 | 30 | hg -v co -m |
|
31 | 31 | |
|
32 | 32 | ls -l ../test[12]/a > foo |
|
33 |
cut -b |
|
|
33 | cut -b 1-10 < foo | |
|
34 | 34 |
@@ -1,21 +1,21 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | mkdir test |
|
4 | 4 | cd test |
|
5 | 5 | echo foo>foo |
|
6 | 6 | hg init |
|
7 | 7 | hg addremove |
|
8 | 8 | hg commit -m 1 |
|
9 | 9 | hg verify |
|
10 | 10 | hg serve -p 20059 -d --pid-file=hg.pid |
|
11 | 11 | cd .. |
|
12 | 12 | |
|
13 | hg clone http://localhost:20059/ copy | |
|
13 | http_proxy= hg clone http://localhost:20059/ copy | |
|
14 | 14 | cd copy |
|
15 | 15 | hg verify |
|
16 | 16 | hg co |
|
17 | 17 | cat foo |
|
18 | 18 | hg manifest |
|
19 | 19 | hg pull |
|
20 | 20 | |
|
21 | 21 | kill `cat ../test/hg.pid` |
@@ -1,41 +1,42 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | http_proxy= hg clone old-http://localhost:20059/ copy | |
|
3 | http_proxy= hg clone old-http://localhost:20059/ copy > clonefail.out 2>&1 | |
|
4 | 4 | echo $? |
|
5 | sed 's/[0-9]//g' < clonefail.out | |
|
5 | 6 | ls copy |
|
6 | 7 | |
|
7 | 8 | # This server doesn't do range requests so it's basically only good for |
|
8 | 9 | # one pull |
|
9 | 10 | cat > dumb.py <<EOF |
|
10 | 11 | import BaseHTTPServer, SimpleHTTPServer, signal |
|
11 | 12 | |
|
12 | 13 | def run(server_class=BaseHTTPServer.HTTPServer, |
|
13 | 14 | handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): |
|
14 | 15 | server_address = ('localhost', 20059) |
|
15 | 16 | httpd = server_class(server_address, handler_class) |
|
16 | 17 | httpd.serve_forever() |
|
17 | 18 | |
|
18 | 19 | signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) |
|
19 | 20 | run() |
|
20 | 21 | EOF |
|
21 | 22 | |
|
22 | 23 | python dumb.py 2>/dev/null & |
|
23 | 24 | |
|
24 | 25 | mkdir remote |
|
25 | 26 | cd remote |
|
26 | 27 | hg init |
|
27 | 28 | echo foo > bar |
|
28 | 29 | hg add bar |
|
29 | 30 | hg commit -m"test" -d"0 0" |
|
30 | 31 | hg tip |
|
31 | 32 | |
|
32 | 33 | cd .. |
|
33 | 34 | |
|
34 | 35 | http_proxy= hg clone old-http://localhost:20059/remote local |
|
35 | 36 | |
|
36 | 37 | cd local |
|
37 | 38 | hg verify |
|
38 | 39 | cat bar |
|
39 | 40 | http_proxy= hg pull |
|
40 | 41 | |
|
41 | 42 | kill $! |
@@ -1,23 +1,23 b'' | |||
|
1 | 255 | |
|
1 | 2 | abort: Connection refused |
|
2 | 255 | |
|
3 | 3 | ls: copy: No such file or directory |
|
4 | 4 | changeset: 0:61c9426e69fe |
|
5 | 5 | tag: tip |
|
6 | 6 | user: test |
|
7 | 7 | date: Thu Jan 1 00:00:00 1970 +0000 |
|
8 | 8 | summary: test |
|
9 | 9 | |
|
10 | 10 | requesting all changes |
|
11 | 11 | adding changesets |
|
12 | 12 | adding manifests |
|
13 | 13 | adding file changes |
|
14 | 14 | added 1 changesets with 1 changes to 1 files |
|
15 | 15 | checking changesets |
|
16 | 16 | checking manifests |
|
17 | 17 | crosschecking files in changesets and manifests |
|
18 | 18 | checking files |
|
19 | 19 | 1 files, 1 changesets, 1 total revisions |
|
20 | 20 | foo |
|
21 | 21 | pulling from old-http://localhost:20059/remote |
|
22 | 22 | searching for changes |
|
23 | 23 | no changes found |
General Comments 0
You need to be logged in to leave comments.
Login now