##// END OF EJS Templates
tests: unify test-static-http
Matt Mackall -
r12491:f0c5c334 default
parent child Browse files
Show More
@@ -1,93 +1,155 b''
1 #!/bin/sh
2
3 cp "$TESTDIR"/printenv.py .
4
5 hg clone http://localhost:$HGPORT/ copy
6 echo $?
7 test -d copy || echo copy: No such file or directory
8
1
9 # This server doesn't do range requests so it's basically only good for
2 $ cp "$TESTDIR"/printenv.py .
10 # one pull
3 $ hg clone http://localhost:$HGPORT/ copy
11 cat > dumb.py <<EOF
4 abort: error: Connection refused
12 import BaseHTTPServer, SimpleHTTPServer, os, signal
5 [255]
6 $ test -d copy
7 [1]
13
8
14 def run(server_class=BaseHTTPServer.HTTPServer,
9 This server doesn't do range requests so it's basically only good for
15 handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
10 one pull
16 server_address = ('localhost', int(os.environ['HGPORT']))
17 httpd = server_class(server_address, handler_class)
18 httpd.serve_forever()
19
11
20 signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
12 $ cat > dumb.py <<EOF
21 run()
13 > import BaseHTTPServer, SimpleHTTPServer, os, signal
22 EOF
14 >
23
15 > def run(server_class=BaseHTTPServer.HTTPServer,
24 python dumb.py 2>/dev/null &
16 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
25 echo $! >> $DAEMON_PIDS
17 > server_address = ('localhost', int(os.environ['HGPORT']))
18 > httpd = server_class(server_address, handler_class)
19 > httpd.serve_forever()
20 >
21 > signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
22 > run()
23 > EOF
24 $ python dumb.py 2>/dev/null &
25 $ echo $! >> $DAEMON_PIDS
26 $ mkdir remote
27 $ cd remote
28 $ hg init
29 $ echo foo > bar
30 $ hg add bar
31 $ hg commit -m"test"
32 $ hg tip
33 changeset: 0:61c9426e69fe
34 tag: tip
35 user: test
36 date: Thu Jan 01 00:00:00 1970 +0000
37 summary: test
38
39 $ cd ..
40 $ hg clone static-http://localhost:$HGPORT/remote local
41 requesting all changes
42 adding changesets
43 adding manifests
44 adding file changes
45 added 1 changesets with 1 changes to 1 files
46 updating to branch default
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 $ cd local
49 $ hg verify
50 checking changesets
51 checking manifests
52 crosschecking files in changesets and manifests
53 checking files
54 1 files, 1 changesets, 1 total revisions
55 $ cat bar
56 foo
57 $ cd ../remote
58 $ echo baz > quux
59 $ hg commit -A -mtest2
60 adding quux
26
61
27 mkdir remote
62 check for HTTP opener failures when cachefile does not exist
28 cd remote
29 hg init
30 echo foo > bar
31 hg add bar
32 hg commit -m"test"
33 hg tip
34
63
35 cd ..
64 $ rm .hg/*.cache
36
65 $ cd ../local
37 hg clone static-http://localhost:$HGPORT/remote local | sed -e "s,:$HGPORT/,:\$HGPORT/,"
66 $ echo '[hooks]' >> .hg/hgrc
38
67 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
39 cd local
68 $ hg pull
40 hg verify
69 changegroup hook: HG_NODE=822d6e31f08b9d6e3b898ce5e52efc0a4bf4905a HG_SOURCE=pull HG_URL=http://localhost:*/remote (glob)
41 cat bar
70 pulling from static-http://localhost:*/remote (glob)
71 searching for changes
72 adding changesets
73 adding manifests
74 adding file changes
75 added 1 changesets with 1 changes to 1 files
76 (run 'hg update' to get a working copy)
42
77
43 cd ../remote
78 trying to push
44 echo baz > quux
45 hg commit -A -mtest2
46 # check for HTTP opener failures when cachefile does not exist
47 rm .hg/*.cache
48
79
49 cd ../local
80 $ hg update
50 echo '[hooks]' >> .hg/hgrc
81 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
82 $ echo more foo >> bar
52 hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
83 $ hg commit -m"test"
84 $ hg push
85 pushing to static-http://localhost:*/remote (glob)
86 abort: cannot lock static-http repository
87 [255]
88
89 trying clone -r
53
90
54 echo '% trying to push'
91 $ cd ..
55 hg update
92 $ hg clone -r donotexist static-http://localhost:$HGPORT/remote local0
56 echo more foo >> bar
93 abort: unknown revision 'donotexist'!
57 hg commit -m"test"
94 [255]
58 hg push | sed -e "s,:$HGPORT/,:\$HGPORT/,"
95 $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
96 requesting all changes
97 adding changesets
98 adding manifests
99 adding file changes
100 added 1 changesets with 1 changes to 1 files
101 updating to branch default
102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59
103
60 echo '% trying clone -r'
104 test with "/" URI (issue 747)
61 cd ..
62 hg clone -r donotexist static-http://localhost:$HGPORT/remote local0 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
63 hg clone -r 0 static-http://localhost:$HGPORT/remote local0 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
64
105
65 echo '% test with "/" URI (issue 747)'
106 $ hg init
66 hg init
107 $ echo a > a
67 echo a > a
108 $ hg add a
68 hg add a
109 $ hg ci -ma
69 hg ci -ma
110 $ hg clone static-http://localhost:$HGPORT/ local2
70
111 requesting all changes
71 hg clone static-http://localhost:$HGPORT/ local2 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
112 adding changesets
72
113 adding manifests
73 cd local2
114 adding file changes
74 hg verify
115 added 1 changesets with 1 changes to 1 files
75 cat a
116 updating to branch default
76 hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/,"
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 $ cd local2
119 $ hg verify
120 checking changesets
121 checking manifests
122 crosschecking files in changesets and manifests
123 checking files
124 1 files, 1 changesets, 1 total revisions
125 $ cat a
126 a
127 $ hg paths
128 default = static-http://localhost:*/ (glob)
77
129
78 echo '% test with empty repo (issue965)'
130 test with empty repo (issue965)
79 cd ..
80 hg init remotempty
81
82 hg clone static-http://localhost:$HGPORT/remotempty local3 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
83
131
84 cd local3
132 $ cd ..
85 hg verify
133 $ hg init remotempty
86 hg paths | sed -e "s,:$HGPORT/,:\$HGPORT/,"
134 $ hg clone static-http://localhost:$HGPORT/remotempty local3
135 no changes found
136 updating to branch default
137 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 $ cd local3
139 $ hg verify
140 checking changesets
141 checking manifests
142 crosschecking files in changesets and manifests
143 checking files
144 0 files, 0 changesets, 0 total revisions
145 $ hg paths
146 default = static-http://localhost:*/remotempty (glob)
87
147
88 echo '% test with non-repo'
148 test with non-repo
89 cd ..
90 mkdir notarepo
91 hg clone static-http://localhost:$HGPORT/notarepo local3 2>&1 | sed -e "s,:$HGPORT/,:\$HGPORT/,"
92
149
93 kill $!
150 $ cd ..
151 $ mkdir notarepo
152 $ hg clone static-http://localhost:$HGPORT/notarepo local3
153 abort: 'http://localhost:*/notarepo' does not appear to be an hg repository! (glob)
154 [255]
155 $ kill $!
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now