##// END OF EJS Templates
test-static-http.t: enable on Windows...
Patrick Mezard -
r17538:31ca918d default
parent child Browse files
Show More
@@ -1,174 +1,191 b''
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" killdaemons || exit 80
2 2
3 3 #if windows
4 4 $ hg clone http://localhost:$HGPORT/ copy
5 5 abort: * (glob)
6 6 [255]
7 7 #else
8 8 $ hg clone http://localhost:$HGPORT/ copy
9 9 abort: error: Connection refused
10 10 [255]
11 11 #endif
12 12 $ test -d copy
13 13 [1]
14 14
15 15 This server doesn't do range requests so it's basically only good for
16 16 one pull
17 17
18 18 $ cat > dumb.py <<EOF
19 19 > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys
20 20 >
21 21 > def run(server_class=BaseHTTPServer.HTTPServer,
22 22 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
23 23 > server_address = ('localhost', int(os.environ['HGPORT']))
24 24 > httpd = server_class(server_address, handler_class)
25 25 > httpd.serve_forever()
26 26 >
27 27 > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
28 > fp = file('dumb.pid', 'wb')
29 > fp.write(str(os.getpid()) + '\n')
30 > fp.close()
28 31 > run()
29 32 > EOF
30 33 $ python dumb.py 2>/dev/null &
31 $ echo $! >> $DAEMON_PIDS
34
35 Cannot just read $!, it will not be set to the right value on Windows/MinGW
36
37 $ cat > wait.py <<EOF
38 > import time
39 > while True:
40 > try:
41 > if '\n' in file('dumb.pid', 'rb').read():
42 > break
43 > except IOError:
44 > pass
45 > time.sleep(0.2)
46 > EOF
47 $ python wait.py
48 $ cat dumb.pid >> $DAEMON_PIDS
32 49 $ hg init remote
33 50 $ cd remote
34 51 $ echo foo > bar
35 52 $ echo c2 > '.dotfile with spaces'
36 53 $ hg add
37 54 adding .dotfile with spaces
38 55 adding bar
39 56 $ hg commit -m"test"
40 57 $ hg tip
41 58 changeset: 0:02770d679fb8
42 59 tag: tip
43 60 user: test
44 61 date: Thu Jan 01 00:00:00 1970 +0000
45 62 summary: test
46 63
47 64 $ cd ..
48 65 $ hg clone static-http://localhost:$HGPORT/remote local
49 66 requesting all changes
50 67 adding changesets
51 68 adding manifests
52 69 adding file changes
53 70 added 1 changesets with 2 changes to 2 files
54 71 updating to branch default
55 72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 73 $ cd local
57 74 $ hg verify
58 75 checking changesets
59 76 checking manifests
60 77 crosschecking files in changesets and manifests
61 78 checking files
62 79 2 files, 1 changesets, 2 total revisions
63 80 $ cat bar
64 81 foo
65 82 $ cd ../remote
66 83 $ echo baz > quux
67 84 $ hg commit -A -mtest2
68 85 adding quux
69 86
70 87 check for HTTP opener failures when cachefile does not exist
71 88
72 89 $ rm .hg/cache/*
73 90 $ cd ../local
74 91 $ echo '[hooks]' >> .hg/hgrc
75 92 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup" >> .hg/hgrc
76 93 $ hg pull
77 94 pulling from static-http://localhost:$HGPORT/remote
78 95 searching for changes
79 96 adding changesets
80 97 adding manifests
81 98 adding file changes
82 99 added 1 changesets with 1 changes to 1 files
83 100 changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote
84 101 (run 'hg update' to get a working copy)
85 102
86 103 trying to push
87 104
88 105 $ hg update
89 106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 107 $ echo more foo >> bar
91 108 $ hg commit -m"test"
92 109 $ hg push
93 110 pushing to static-http://localhost:$HGPORT/remote
94 111 abort: destination does not support push
95 112 [255]
96 113
97 114 trying clone -r
98 115
99 116 $ cd ..
100 117 $ hg clone -r doesnotexist static-http://localhost:$HGPORT/remote local0
101 118 abort: unknown revision 'doesnotexist'!
102 119 [255]
103 120 $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
104 121 adding changesets
105 122 adding manifests
106 123 adding file changes
107 124 added 1 changesets with 2 changes to 2 files
108 125 updating to branch default
109 126 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 127
111 128 test with "/" URI (issue 747) and subrepo
112 129
113 130 $ hg init
114 131 $ hg init sub
115 132 $ touch sub/test
116 133 $ hg -R sub commit -A -m "test"
117 134 adding test
118 135 $ hg -R sub tag not-empty
119 136 $ echo sub=sub > .hgsub
120 137 $ echo a > a
121 138 $ hg add a .hgsub
122 139 $ hg -q ci -ma
123 140 $ hg clone static-http://localhost:$HGPORT/ local2
124 141 requesting all changes
125 142 adding changesets
126 143 adding manifests
127 144 adding file changes
128 145 added 1 changesets with 3 changes to 3 files
129 146 updating to branch default
130 147 cloning subrepo sub from static-http://localhost:$HGPORT/sub
131 148 requesting all changes
132 149 adding changesets
133 150 adding manifests
134 151 adding file changes
135 152 added 2 changesets with 2 changes to 2 files
136 153 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 154 $ cd local2
138 155 $ hg verify
139 156 checking changesets
140 157 checking manifests
141 158 crosschecking files in changesets and manifests
142 159 checking files
143 160 3 files, 1 changesets, 3 total revisions
144 161 $ cat a
145 162 a
146 163 $ hg paths
147 164 default = static-http://localhost:$HGPORT/
148 165
149 166 test with empty repo (issue965)
150 167
151 168 $ cd ..
152 169 $ hg init remotempty
153 170 $ hg clone static-http://localhost:$HGPORT/remotempty local3
154 171 no changes found
155 172 updating to branch default
156 173 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
157 174 $ cd local3
158 175 $ hg verify
159 176 checking changesets
160 177 checking manifests
161 178 crosschecking files in changesets and manifests
162 179 checking files
163 180 0 files, 0 changesets, 0 total revisions
164 181 $ hg paths
165 182 default = static-http://localhost:$HGPORT/remotempty
166 183
167 184 test with non-repo
168 185
169 186 $ cd ..
170 187 $ mkdir notarepo
171 188 $ hg clone static-http://localhost:$HGPORT/notarepo local3
172 189 abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
173 190 [255]
174 $ kill $!
191 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
General Comments 0
You need to be logged in to leave comments. Login now