##// END OF EJS Templates
tests: ignore http tests that are known wontfix failures on python 2.4...
Mads Kiilerich -
r20384:c499fff7 default
parent child Browse files
Show More
@@ -1,340 +1,344
1 import os, stat, socket
1 import os, stat, socket
2 import re
2 import re
3 import sys
3 import sys
4 import tempfile
4 import tempfile
5
5
6 tempprefix = 'hg-hghave-'
6 tempprefix = 'hg-hghave-'
7
7
8 def matchoutput(cmd, regexp, ignorestatus=False):
8 def matchoutput(cmd, regexp, ignorestatus=False):
9 """Return True if cmd executes successfully and its output
9 """Return True if cmd executes successfully and its output
10 is matched by the supplied regular expression.
10 is matched by the supplied regular expression.
11 """
11 """
12 r = re.compile(regexp)
12 r = re.compile(regexp)
13 fh = os.popen(cmd)
13 fh = os.popen(cmd)
14 s = fh.read()
14 s = fh.read()
15 try:
15 try:
16 ret = fh.close()
16 ret = fh.close()
17 except IOError:
17 except IOError:
18 # Happen in Windows test environment
18 # Happen in Windows test environment
19 ret = 1
19 ret = 1
20 return (ignorestatus or ret is None) and r.search(s)
20 return (ignorestatus or ret is None) and r.search(s)
21
21
22 def has_baz():
22 def has_baz():
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
24
24
25 def has_bzr():
25 def has_bzr():
26 try:
26 try:
27 import bzrlib
27 import bzrlib
28 return bzrlib.__doc__ is not None
28 return bzrlib.__doc__ is not None
29 except ImportError:
29 except ImportError:
30 return False
30 return False
31
31
32 def has_bzr114():
32 def has_bzr114():
33 try:
33 try:
34 import bzrlib
34 import bzrlib
35 return (bzrlib.__doc__ is not None
35 return (bzrlib.__doc__ is not None
36 and bzrlib.version_info[:2] >= (1, 14))
36 and bzrlib.version_info[:2] >= (1, 14))
37 except ImportError:
37 except ImportError:
38 return False
38 return False
39
39
40 def has_cvs():
40 def has_cvs():
41 re = r'Concurrent Versions System.*?server'
41 re = r'Concurrent Versions System.*?server'
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
43
43
44 def has_cvs112():
44 def has_cvs112():
45 re = r'Concurrent Versions System \(CVS\) 1.12.*?server'
45 re = r'Concurrent Versions System \(CVS\) 1.12.*?server'
46 return matchoutput('cvs --version 2>&1', re) and not has_msys()
46 return matchoutput('cvs --version 2>&1', re) and not has_msys()
47
47
48 def has_darcs():
48 def has_darcs():
49 return matchoutput('darcs --version', r'2\.[2-9]', True)
49 return matchoutput('darcs --version', r'2\.[2-9]', True)
50
50
51 def has_mtn():
51 def has_mtn():
52 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
52 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
53 'mtn --version', r'monotone 0\.', True)
53 'mtn --version', r'monotone 0\.', True)
54
54
55 def has_eol_in_paths():
55 def has_eol_in_paths():
56 try:
56 try:
57 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
57 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
58 os.close(fd)
58 os.close(fd)
59 os.remove(path)
59 os.remove(path)
60 return True
60 return True
61 except (IOError, OSError):
61 except (IOError, OSError):
62 return False
62 return False
63
63
64 def has_executablebit():
64 def has_executablebit():
65 try:
65 try:
66 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
66 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
67 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
67 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
68 try:
68 try:
69 os.close(fh)
69 os.close(fh)
70 m = os.stat(fn).st_mode & 0777
70 m = os.stat(fn).st_mode & 0777
71 new_file_has_exec = m & EXECFLAGS
71 new_file_has_exec = m & EXECFLAGS
72 os.chmod(fn, m ^ EXECFLAGS)
72 os.chmod(fn, m ^ EXECFLAGS)
73 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
73 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
74 finally:
74 finally:
75 os.unlink(fn)
75 os.unlink(fn)
76 except (IOError, OSError):
76 except (IOError, OSError):
77 # we don't care, the user probably won't be able to commit anyway
77 # we don't care, the user probably won't be able to commit anyway
78 return False
78 return False
79 return not (new_file_has_exec or exec_flags_cannot_flip)
79 return not (new_file_has_exec or exec_flags_cannot_flip)
80
80
81 def has_icasefs():
81 def has_icasefs():
82 # Stolen from mercurial.util
82 # Stolen from mercurial.util
83 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
83 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
84 os.close(fd)
84 os.close(fd)
85 try:
85 try:
86 s1 = os.stat(path)
86 s1 = os.stat(path)
87 d, b = os.path.split(path)
87 d, b = os.path.split(path)
88 p2 = os.path.join(d, b.upper())
88 p2 = os.path.join(d, b.upper())
89 if path == p2:
89 if path == p2:
90 p2 = os.path.join(d, b.lower())
90 p2 = os.path.join(d, b.lower())
91 try:
91 try:
92 s2 = os.stat(p2)
92 s2 = os.stat(p2)
93 return s2 == s1
93 return s2 == s1
94 except OSError:
94 except OSError:
95 return False
95 return False
96 finally:
96 finally:
97 os.remove(path)
97 os.remove(path)
98
98
99 def has_inotify():
99 def has_inotify():
100 try:
100 try:
101 import hgext.inotify.linux.watcher
101 import hgext.inotify.linux.watcher
102 except ImportError:
102 except ImportError:
103 return False
103 return False
104 name = tempfile.mktemp(dir='.', prefix=tempprefix)
104 name = tempfile.mktemp(dir='.', prefix=tempprefix)
105 sock = socket.socket(socket.AF_UNIX)
105 sock = socket.socket(socket.AF_UNIX)
106 try:
106 try:
107 sock.bind(name)
107 sock.bind(name)
108 except socket.error:
108 except socket.error:
109 return False
109 return False
110 sock.close()
110 sock.close()
111 os.unlink(name)
111 os.unlink(name)
112 return True
112 return True
113
113
114 def has_fifo():
114 def has_fifo():
115 if getattr(os, "mkfifo", None) is None:
115 if getattr(os, "mkfifo", None) is None:
116 return False
116 return False
117 name = tempfile.mktemp(dir='.', prefix=tempprefix)
117 name = tempfile.mktemp(dir='.', prefix=tempprefix)
118 try:
118 try:
119 os.mkfifo(name)
119 os.mkfifo(name)
120 os.unlink(name)
120 os.unlink(name)
121 return True
121 return True
122 except OSError:
122 except OSError:
123 return False
123 return False
124
124
125 def has_killdaemons():
125 def has_killdaemons():
126 return True
126 return True
127
127
128 def has_cacheable_fs():
128 def has_cacheable_fs():
129 from mercurial import util
129 from mercurial import util
130
130
131 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
131 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
132 os.close(fd)
132 os.close(fd)
133 try:
133 try:
134 return util.cachestat(path).cacheable()
134 return util.cachestat(path).cacheable()
135 finally:
135 finally:
136 os.remove(path)
136 os.remove(path)
137
137
138 def has_lsprof():
138 def has_lsprof():
139 try:
139 try:
140 import _lsprof
140 import _lsprof
141 return True
141 return True
142 except ImportError:
142 except ImportError:
143 return False
143 return False
144
144
145 def has_gettext():
145 def has_gettext():
146 return matchoutput('msgfmt --version', 'GNU gettext-tools')
146 return matchoutput('msgfmt --version', 'GNU gettext-tools')
147
147
148 def has_git():
148 def has_git():
149 return matchoutput('git --version 2>&1', r'^git version')
149 return matchoutput('git --version 2>&1', r'^git version')
150
150
151 def has_docutils():
151 def has_docutils():
152 try:
152 try:
153 from docutils.core import publish_cmdline
153 from docutils.core import publish_cmdline
154 return True
154 return True
155 except ImportError:
155 except ImportError:
156 return False
156 return False
157
157
158 def getsvnversion():
158 def getsvnversion():
159 m = matchoutput('svn --version --quiet 2>&1', r'^(\d+)\.(\d+)')
159 m = matchoutput('svn --version --quiet 2>&1', r'^(\d+)\.(\d+)')
160 if not m:
160 if not m:
161 return (0, 0)
161 return (0, 0)
162 return (int(m.group(1)), int(m.group(2)))
162 return (int(m.group(1)), int(m.group(2)))
163
163
164 def has_svn15():
164 def has_svn15():
165 return getsvnversion() >= (1, 5)
165 return getsvnversion() >= (1, 5)
166
166
167 def has_svn13():
167 def has_svn13():
168 return getsvnversion() >= (1, 3)
168 return getsvnversion() >= (1, 3)
169
169
170 def has_svn():
170 def has_svn():
171 return matchoutput('svn --version 2>&1', r'^svn, version') and \
171 return matchoutput('svn --version 2>&1', r'^svn, version') and \
172 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
172 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
173
173
174 def has_svn_bindings():
174 def has_svn_bindings():
175 try:
175 try:
176 import svn.core
176 import svn.core
177 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
177 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
178 if version < (1, 4):
178 if version < (1, 4):
179 return False
179 return False
180 return True
180 return True
181 except ImportError:
181 except ImportError:
182 return False
182 return False
183
183
184 def has_p4():
184 def has_p4():
185 return (matchoutput('p4 -V', r'Rev\. P4/') and
185 return (matchoutput('p4 -V', r'Rev\. P4/') and
186 matchoutput('p4d -V', r'Rev\. P4D/'))
186 matchoutput('p4d -V', r'Rev\. P4D/'))
187
187
188 def has_symlink():
188 def has_symlink():
189 if getattr(os, "symlink", None) is None:
189 if getattr(os, "symlink", None) is None:
190 return False
190 return False
191 name = tempfile.mktemp(dir='.', prefix=tempprefix)
191 name = tempfile.mktemp(dir='.', prefix=tempprefix)
192 try:
192 try:
193 os.symlink(".", name)
193 os.symlink(".", name)
194 os.unlink(name)
194 os.unlink(name)
195 return True
195 return True
196 except (OSError, AttributeError):
196 except (OSError, AttributeError):
197 return False
197 return False
198
198
199 def has_hardlink():
199 def has_hardlink():
200 from mercurial import util
200 from mercurial import util
201 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
201 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
202 os.close(fh)
202 os.close(fh)
203 name = tempfile.mktemp(dir='.', prefix=tempprefix)
203 name = tempfile.mktemp(dir='.', prefix=tempprefix)
204 try:
204 try:
205 try:
205 try:
206 util.oslink(fn, name)
206 util.oslink(fn, name)
207 os.unlink(name)
207 os.unlink(name)
208 return True
208 return True
209 except OSError:
209 except OSError:
210 return False
210 return False
211 finally:
211 finally:
212 os.unlink(fn)
212 os.unlink(fn)
213
213
214 def has_tla():
214 def has_tla():
215 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
215 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
216
216
217 def has_gpg():
217 def has_gpg():
218 return matchoutput('gpg --version 2>&1', r'GnuPG')
218 return matchoutput('gpg --version 2>&1', r'GnuPG')
219
219
220 def has_unix_permissions():
220 def has_unix_permissions():
221 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
221 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
222 try:
222 try:
223 fname = os.path.join(d, 'foo')
223 fname = os.path.join(d, 'foo')
224 for umask in (077, 007, 022):
224 for umask in (077, 007, 022):
225 os.umask(umask)
225 os.umask(umask)
226 f = open(fname, 'w')
226 f = open(fname, 'w')
227 f.close()
227 f.close()
228 mode = os.stat(fname).st_mode
228 mode = os.stat(fname).st_mode
229 os.unlink(fname)
229 os.unlink(fname)
230 if mode & 0777 != ~umask & 0666:
230 if mode & 0777 != ~umask & 0666:
231 return False
231 return False
232 return True
232 return True
233 finally:
233 finally:
234 os.rmdir(d)
234 os.rmdir(d)
235
235
236 def has_root():
236 def has_root():
237 return getattr(os, 'geteuid', None) and os.geteuid() == 0
237 return getattr(os, 'geteuid', None) and os.geteuid() == 0
238
238
239 def has_pyflakes():
239 def has_pyflakes():
240 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
240 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
241 r"<stdin>:1: 're' imported but unused",
241 r"<stdin>:1: 're' imported but unused",
242 True)
242 True)
243
243
244 def has_pygments():
244 def has_pygments():
245 try:
245 try:
246 import pygments
246 import pygments
247 return True
247 return True
248 except ImportError:
248 except ImportError:
249 return False
249 return False
250
250
251 def has_python243():
252 return sys.version_info >= (2, 4, 3)
253
251 def has_outer_repo():
254 def has_outer_repo():
252 # failing for other reasons than 'no repo' imply that there is a repo
255 # failing for other reasons than 'no repo' imply that there is a repo
253 return not matchoutput('hg root 2>&1',
256 return not matchoutput('hg root 2>&1',
254 r'abort: no repository found', True)
257 r'abort: no repository found', True)
255
258
256 def has_ssl():
259 def has_ssl():
257 try:
260 try:
258 import ssl
261 import ssl
259 import OpenSSL
262 import OpenSSL
260 OpenSSL.SSL.Context
263 OpenSSL.SSL.Context
261 return True
264 return True
262 except ImportError:
265 except ImportError:
263 return False
266 return False
264
267
265 def has_windows():
268 def has_windows():
266 return os.name == 'nt'
269 return os.name == 'nt'
267
270
268 def has_system_sh():
271 def has_system_sh():
269 return os.name != 'nt'
272 return os.name != 'nt'
270
273
271 def has_serve():
274 def has_serve():
272 return os.name != 'nt' # gross approximation
275 return os.name != 'nt' # gross approximation
273
276
274 def has_tic():
277 def has_tic():
275 try:
278 try:
276 import curses
279 import curses
277 curses.COLOR_BLUE
280 curses.COLOR_BLUE
278 return matchoutput('test -x "`which tic`"', '')
281 return matchoutput('test -x "`which tic`"', '')
279 except ImportError:
282 except ImportError:
280 return False
283 return False
281
284
282 def has_msys():
285 def has_msys():
283 return os.getenv('MSYSTEM')
286 return os.getenv('MSYSTEM')
284
287
285 def has_aix():
288 def has_aix():
286 return sys.platform.startswith("aix")
289 return sys.platform.startswith("aix")
287
290
288 def has_absimport():
291 def has_absimport():
289 import __future__
292 import __future__
290 from mercurial import util
293 from mercurial import util
291 return util.safehasattr(__future__, "absolute_import")
294 return util.safehasattr(__future__, "absolute_import")
292
295
293 def has_py3k():
296 def has_py3k():
294 return 3 == sys.version_info[0]
297 return 3 == sys.version_info[0]
295
298
296 checks = {
299 checks = {
297 "true": (lambda: True, "yak shaving"),
300 "true": (lambda: True, "yak shaving"),
298 "false": (lambda: False, "nail clipper"),
301 "false": (lambda: False, "nail clipper"),
299 "baz": (has_baz, "GNU Arch baz client"),
302 "baz": (has_baz, "GNU Arch baz client"),
300 "bzr": (has_bzr, "Canonical's Bazaar client"),
303 "bzr": (has_bzr, "Canonical's Bazaar client"),
301 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
304 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
302 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
305 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
303 "cvs": (has_cvs, "cvs client/server"),
306 "cvs": (has_cvs, "cvs client/server"),
304 "cvs112": (has_cvs112, "cvs client/server >= 1.12"),
307 "cvs112": (has_cvs112, "cvs client/server >= 1.12"),
305 "darcs": (has_darcs, "darcs client"),
308 "darcs": (has_darcs, "darcs client"),
306 "docutils": (has_docutils, "Docutils text processing library"),
309 "docutils": (has_docutils, "Docutils text processing library"),
307 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
310 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
308 "execbit": (has_executablebit, "executable bit"),
311 "execbit": (has_executablebit, "executable bit"),
309 "fifo": (has_fifo, "named pipes"),
312 "fifo": (has_fifo, "named pipes"),
310 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
313 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
311 "git": (has_git, "git command line client"),
314 "git": (has_git, "git command line client"),
312 "gpg": (has_gpg, "gpg client"),
315 "gpg": (has_gpg, "gpg client"),
313 "hardlink": (has_hardlink, "hardlinks"),
316 "hardlink": (has_hardlink, "hardlinks"),
314 "icasefs": (has_icasefs, "case insensitive file system"),
317 "icasefs": (has_icasefs, "case insensitive file system"),
315 "inotify": (has_inotify, "inotify extension support"),
318 "inotify": (has_inotify, "inotify extension support"),
316 "killdaemons": (has_killdaemons, 'killdaemons.py support'),
319 "killdaemons": (has_killdaemons, 'killdaemons.py support'),
317 "lsprof": (has_lsprof, "python lsprof module"),
320 "lsprof": (has_lsprof, "python lsprof module"),
318 "mtn": (has_mtn, "monotone client (>= 1.0)"),
321 "mtn": (has_mtn, "monotone client (>= 1.0)"),
319 "outer-repo": (has_outer_repo, "outer repo"),
322 "outer-repo": (has_outer_repo, "outer repo"),
320 "p4": (has_p4, "Perforce server and client"),
323 "p4": (has_p4, "Perforce server and client"),
321 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
324 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
322 "pygments": (has_pygments, "Pygments source highlighting library"),
325 "pygments": (has_pygments, "Pygments source highlighting library"),
326 "python243": (has_python243, "python >= 2.4.3"),
323 "root": (has_root, "root permissions"),
327 "root": (has_root, "root permissions"),
324 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
328 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
325 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
329 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
326 "svn": (has_svn, "subversion client and admin tools"),
330 "svn": (has_svn, "subversion client and admin tools"),
327 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
331 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
328 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
332 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
329 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
333 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
330 "symlink": (has_symlink, "symbolic links"),
334 "symlink": (has_symlink, "symbolic links"),
331 "system-sh": (has_system_sh, "system() uses sh"),
335 "system-sh": (has_system_sh, "system() uses sh"),
332 "tic": (has_tic, "terminfo compiler and curses module"),
336 "tic": (has_tic, "terminfo compiler and curses module"),
333 "tla": (has_tla, "GNU Arch tla client"),
337 "tla": (has_tla, "GNU Arch tla client"),
334 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
338 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
335 "windows": (has_windows, "Windows"),
339 "windows": (has_windows, "Windows"),
336 "msys": (has_msys, "Windows with MSYS"),
340 "msys": (has_msys, "Windows with MSYS"),
337 "aix": (has_aix, "AIX"),
341 "aix": (has_aix, "AIX"),
338 "absimport": (has_absimport, "absolute_import in __future__"),
342 "absimport": (has_absimport, "absolute_import in __future__"),
339 "py3k": (has_py3k, "running with Python 3.x"),
343 "py3k": (has_py3k, "running with Python 3.x"),
340 }
344 }
@@ -1,237 +1,241
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" serve || exit 80
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo foo>foo
5 $ echo foo>foo
6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
7 $ echo foo>foo.d/foo
7 $ echo foo>foo.d/foo
8 $ echo bar>foo.d/bAr.hg.d/BaR
8 $ echo bar>foo.d/bAr.hg.d/BaR
9 $ echo bar>foo.d/baR.d.hg/bAR
9 $ echo bar>foo.d/baR.d.hg/bAR
10 $ hg commit -A -m 1
10 $ hg commit -A -m 1
11 adding foo
11 adding foo
12 adding foo.d/bAr.hg.d/BaR
12 adding foo.d/bAr.hg.d/BaR
13 adding foo.d/baR.d.hg/bAR
13 adding foo.d/baR.d.hg/bAR
14 adding foo.d/foo
14 adding foo.d/foo
15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
16 $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
16 $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
17
17
18 Test server address cannot be reused
18 Test server address cannot be reused
19
19
20 #if windows
20 #if windows
21 $ hg serve -p $HGPORT1 2>&1
21 $ hg serve -p $HGPORT1 2>&1
22 abort: cannot start server at ':$HGPORT1': * (glob)
22 abort: cannot start server at ':$HGPORT1': * (glob)
23 [255]
23 [255]
24 #else
24 #else
25 $ hg serve -p $HGPORT1 2>&1
25 $ hg serve -p $HGPORT1 2>&1
26 abort: cannot start server at ':$HGPORT1': Address already in use
26 abort: cannot start server at ':$HGPORT1': Address already in use
27 [255]
27 [255]
28 #endif
28 #endif
29 $ cd ..
29 $ cd ..
30 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
30 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
31
31
32 clone via stream
32 clone via stream
33
33
34 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
34 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
35 streaming all changes
35 streaming all changes
36 6 files to transfer, 606 bytes of data
36 6 files to transfer, 606 bytes of data
37 transferred * bytes in * seconds (*/sec) (glob)
37 transferred * bytes in * seconds (*/sec) (glob)
38 updating to branch default
38 updating to branch default
39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 $ hg verify -R copy
40 $ hg verify -R copy
41 checking changesets
41 checking changesets
42 checking manifests
42 checking manifests
43 crosschecking files in changesets and manifests
43 crosschecking files in changesets and manifests
44 checking files
44 checking files
45 4 files, 1 changesets, 4 total revisions
45 4 files, 1 changesets, 4 total revisions
46
46
47 try to clone via stream, should use pull instead
47 try to clone via stream, should use pull instead
48
48
49 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
49 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
50 requesting all changes
50 requesting all changes
51 adding changesets
51 adding changesets
52 adding manifests
52 adding manifests
53 adding file changes
53 adding file changes
54 added 1 changesets with 4 changes to 4 files
54 added 1 changesets with 4 changes to 4 files
55 updating to branch default
55 updating to branch default
56 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
57
57
58 clone via pull
58 clone via pull
59
59
60 $ hg clone http://localhost:$HGPORT1/ copy-pull
60 $ hg clone http://localhost:$HGPORT1/ copy-pull
61 requesting all changes
61 requesting all changes
62 adding changesets
62 adding changesets
63 adding manifests
63 adding manifests
64 adding file changes
64 adding file changes
65 added 1 changesets with 4 changes to 4 files
65 added 1 changesets with 4 changes to 4 files
66 updating to branch default
66 updating to branch default
67 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 $ hg verify -R copy-pull
68 $ hg verify -R copy-pull
69 checking changesets
69 checking changesets
70 checking manifests
70 checking manifests
71 crosschecking files in changesets and manifests
71 crosschecking files in changesets and manifests
72 checking files
72 checking files
73 4 files, 1 changesets, 4 total revisions
73 4 files, 1 changesets, 4 total revisions
74 $ cd test
74 $ cd test
75 $ echo bar > bar
75 $ echo bar > bar
76 $ hg commit -A -d '1 0' -m 2
76 $ hg commit -A -d '1 0' -m 2
77 adding bar
77 adding bar
78 $ cd ..
78 $ cd ..
79
79
80 clone over http with --update
80 clone over http with --update
81
81
82 $ hg clone http://localhost:$HGPORT1/ updated --update 0
82 $ hg clone http://localhost:$HGPORT1/ updated --update 0
83 requesting all changes
83 requesting all changes
84 adding changesets
84 adding changesets
85 adding manifests
85 adding manifests
86 adding file changes
86 adding file changes
87 added 2 changesets with 5 changes to 5 files
87 added 2 changesets with 5 changes to 5 files
88 updating to branch default
88 updating to branch default
89 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 $ hg log -r . -R updated
90 $ hg log -r . -R updated
91 changeset: 0:8b6053c928fe
91 changeset: 0:8b6053c928fe
92 user: test
92 user: test
93 date: Thu Jan 01 00:00:00 1970 +0000
93 date: Thu Jan 01 00:00:00 1970 +0000
94 summary: 1
94 summary: 1
95
95
96 $ rm -rf updated
96 $ rm -rf updated
97
97
98 incoming via HTTP
98 incoming via HTTP
99
99
100 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
100 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
101 adding changesets
101 adding changesets
102 adding manifests
102 adding manifests
103 adding file changes
103 adding file changes
104 added 1 changesets with 4 changes to 4 files
104 added 1 changesets with 4 changes to 4 files
105 updating to branch default
105 updating to branch default
106 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 $ cd partial
107 $ cd partial
108 $ touch LOCAL
108 $ touch LOCAL
109 $ hg ci -qAm LOCAL
109 $ hg ci -qAm LOCAL
110 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
110 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
111 comparing with http://localhost:$HGPORT1/
111 comparing with http://localhost:$HGPORT1/
112 searching for changes
112 searching for changes
113 2
113 2
114 $ cd ..
114 $ cd ..
115
115
116 pull
116 pull
117
117
118 $ cd copy-pull
118 $ cd copy-pull
119 $ echo '[hooks]' >> .hg/hgrc
119 $ echo '[hooks]' >> .hg/hgrc
120 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup" >> .hg/hgrc
120 $ echo "changegroup = python \"$TESTDIR/printenv.py\" changegroup" >> .hg/hgrc
121 $ hg pull
121 $ hg pull
122 pulling from http://localhost:$HGPORT1/
122 pulling from http://localhost:$HGPORT1/
123 searching for changes
123 searching for changes
124 adding changesets
124 adding changesets
125 adding manifests
125 adding manifests
126 adding file changes
126 adding file changes
127 added 1 changesets with 1 changes to 1 files
127 added 1 changesets with 1 changes to 1 files
128 changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
128 changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
129 (run 'hg update' to get a working copy)
129 (run 'hg update' to get a working copy)
130 $ cd ..
130 $ cd ..
131
131
132 clone from invalid URL
132 clone from invalid URL
133
133
134 $ hg clone http://localhost:$HGPORT/bad
134 $ hg clone http://localhost:$HGPORT/bad
135 abort: HTTP Error 404: Not Found
135 abort: HTTP Error 404: Not Found
136 [255]
136 [255]
137
137
138 test http authentication
138 test http authentication
139 + use the same server to test server side streaming preference
139 + use the same server to test server side streaming preference
140
140
141 $ cd test
141 $ cd test
142 $ cat << EOT > userpass.py
142 $ cat << EOT > userpass.py
143 > import base64
143 > import base64
144 > from mercurial.hgweb import common
144 > from mercurial.hgweb import common
145 > def perform_authentication(hgweb, req, op):
145 > def perform_authentication(hgweb, req, op):
146 > auth = req.env.get('HTTP_AUTHORIZATION')
146 > auth = req.env.get('HTTP_AUTHORIZATION')
147 > if not auth:
147 > if not auth:
148 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
148 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
149 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
149 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
150 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
150 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
151 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
151 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
152 > def extsetup():
152 > def extsetup():
153 > common.permhooks.insert(0, perform_authentication)
153 > common.permhooks.insert(0, perform_authentication)
154 > EOT
154 > EOT
155 $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
155 $ hg --config extensions.x=userpass.py serve -p $HGPORT2 -d --pid-file=pid \
156 > --config server.preferuncompressed=True
156 > --config server.preferuncompressed=True
157 $ cat pid >> $DAEMON_PIDS
157 $ cat pid >> $DAEMON_PIDS
158
158
159 $ cat << EOF > get_pass.py
159 $ cat << EOF > get_pass.py
160 > import getpass
160 > import getpass
161 > def newgetpass(arg):
161 > def newgetpass(arg):
162 > return "pass"
162 > return "pass"
163 > getpass.getpass = newgetpass
163 > getpass.getpass = newgetpass
164 > EOF
164 > EOF
165
165
166 #if python243
166 $ hg id http://localhost:$HGPORT2/
167 $ hg id http://localhost:$HGPORT2/
167 abort: http authorization required for http://localhost:$HGPORT2/
168 abort: http authorization required for http://localhost:$HGPORT2/
168 [255]
169 [255]
169 $ hg id http://localhost:$HGPORT2/
170 $ hg id http://localhost:$HGPORT2/
170 abort: http authorization required for http://localhost:$HGPORT2/
171 abort: http authorization required for http://localhost:$HGPORT2/
171 [255]
172 [255]
172 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
173 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
173 http authorization required for http://localhost:$HGPORT2/
174 http authorization required for http://localhost:$HGPORT2/
174 realm: mercurial
175 realm: mercurial
175 user: user
176 user: user
176 password: 5fed3813f7f5
177 password: 5fed3813f7f5
177 $ hg id http://user:pass@localhost:$HGPORT2/
178 $ hg id http://user:pass@localhost:$HGPORT2/
178 5fed3813f7f5
179 5fed3813f7f5
180 #endif
179 $ echo '[auth]' >> .hg/hgrc
181 $ echo '[auth]' >> .hg/hgrc
180 $ echo 'l.schemes=http' >> .hg/hgrc
182 $ echo 'l.schemes=http' >> .hg/hgrc
181 $ echo 'l.prefix=lo' >> .hg/hgrc
183 $ echo 'l.prefix=lo' >> .hg/hgrc
182 $ echo 'l.username=user' >> .hg/hgrc
184 $ echo 'l.username=user' >> .hg/hgrc
183 $ echo 'l.password=pass' >> .hg/hgrc
185 $ echo 'l.password=pass' >> .hg/hgrc
184 $ hg id http://localhost:$HGPORT2/
186 $ hg id http://localhost:$HGPORT2/
185 5fed3813f7f5
187 5fed3813f7f5
186 $ hg id http://localhost:$HGPORT2/
188 $ hg id http://localhost:$HGPORT2/
187 5fed3813f7f5
189 5fed3813f7f5
188 $ hg id http://user@localhost:$HGPORT2/
190 $ hg id http://user@localhost:$HGPORT2/
189 5fed3813f7f5
191 5fed3813f7f5
192 #if python243
190 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
193 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
191 streaming all changes
194 streaming all changes
192 7 files to transfer, 916 bytes of data
195 7 files to transfer, 916 bytes of data
193 transferred * bytes in * seconds (*/sec) (glob)
196 transferred * bytes in * seconds (*/sec) (glob)
194 updating to branch default
197 updating to branch default
195 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
196
199
197 $ hg id http://user2@localhost:$HGPORT2/
200 $ hg id http://user2@localhost:$HGPORT2/
198 abort: http authorization required for http://localhost:$HGPORT2/
201 abort: http authorization required for http://localhost:$HGPORT2/
199 [255]
202 [255]
200 $ hg id http://user:pass2@localhost:$HGPORT2/
203 $ hg id http://user:pass2@localhost:$HGPORT2/
201 abort: HTTP Error 403: no
204 abort: HTTP Error 403: no
202 [255]
205 [255]
206 #endif
203
207
204 $ cd ..
208 $ cd ..
205
209
206 clone of serve with repo in root and unserved subrepo (issue2970)
210 clone of serve with repo in root and unserved subrepo (issue2970)
207
211
208 $ hg --cwd test init sub
212 $ hg --cwd test init sub
209 $ echo empty > test/sub/empty
213 $ echo empty > test/sub/empty
210 $ hg --cwd test/sub add empty
214 $ hg --cwd test/sub add empty
211 $ hg --cwd test/sub commit -qm 'add empty'
215 $ hg --cwd test/sub commit -qm 'add empty'
212 $ hg --cwd test/sub tag -r 0 something
216 $ hg --cwd test/sub tag -r 0 something
213 $ echo sub = sub > test/.hgsub
217 $ echo sub = sub > test/.hgsub
214 $ hg --cwd test add .hgsub
218 $ hg --cwd test add .hgsub
215 $ hg --cwd test commit -qm 'add subrepo'
219 $ hg --cwd test commit -qm 'add subrepo'
216 $ hg clone http://localhost:$HGPORT noslash-clone
220 $ hg clone http://localhost:$HGPORT noslash-clone
217 requesting all changes
221 requesting all changes
218 adding changesets
222 adding changesets
219 adding manifests
223 adding manifests
220 adding file changes
224 adding file changes
221 added 3 changesets with 7 changes to 7 files
225 added 3 changesets with 7 changes to 7 files
222 updating to branch default
226 updating to branch default
223 abort: HTTP Error 404: Not Found
227 abort: HTTP Error 404: Not Found
224 [255]
228 [255]
225 $ hg clone http://localhost:$HGPORT/ slash-clone
229 $ hg clone http://localhost:$HGPORT/ slash-clone
226 requesting all changes
230 requesting all changes
227 adding changesets
231 adding changesets
228 adding manifests
232 adding manifests
229 adding file changes
233 adding file changes
230 added 3 changesets with 7 changes to 7 files
234 added 3 changesets with 7 changes to 7 files
231 updating to branch default
235 updating to branch default
232 abort: HTTP Error 404: Not Found
236 abort: HTTP Error 404: Not Found
233 [255]
237 [255]
234
238
235 check error log
239 check error log
236
240
237 $ cat error.log
241 $ cat error.log
General Comments 0
You need to be logged in to leave comments. Login now