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