Show More
@@ -1,6 +1,5 b'' | |||
|
1 | 1 | stages: |
|
2 | 2 | - tests |
|
3 | - phabricator | |
|
4 | 3 | |
|
5 | 4 | image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG |
|
6 | 5 | |
@@ -45,24 +44,6 b' rust-cargo-test:' | |||
|
45 | 44 | variables: |
|
46 | 45 | PYTHON: python3 |
|
47 | 46 | |
|
48 | phabricator-refresh: | |
|
49 | stage: phabricator | |
|
50 | except: | |
|
51 | refs: | |
|
52 | - merge_requests | |
|
53 | variables: | |
|
54 | - $PHABRICATOR_TOKEN == "NO-PHAB" | |
|
55 | variables: | |
|
56 | DEFAULT_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)" | |
|
57 | STABLE_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)\n⚠ This patch is intended for stable ⚠\n{image https://media.giphy.com/media/nYI8SmmChYXK0/source.gif}" | |
|
58 | script: | |
|
59 | - | | |
|
60 | if [ `hg branch` == "stable" ]; then | |
|
61 | ./contrib/phab-refresh-stack.sh --comment "$STABLE_COMMENT"; | |
|
62 | else | |
|
63 | ./contrib/phab-refresh-stack.sh --comment "$DEFAULT_COMMENT"; | |
|
64 | fi | |
|
65 | ||
|
66 | 47 | test-c: |
|
67 | 48 | <<: *runtests |
|
68 | 49 | variables: |
@@ -16,3 +16,6 b' RUN yum install -y createrepo' | |||
|
16 | 16 | |
|
17 | 17 | # For rust extensions |
|
18 | 18 | RUN yum install -y cargo |
|
19 | ||
|
20 | # avoid incorrect docker image permissions on /tmp preventing writes by non-root users | |
|
21 | RUN chmod 1777 /tmp |
@@ -62,6 +62,9 b' IGNORES = {' | |||
|
62 | 62 | if _pypy: |
|
63 | 63 | # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5) |
|
64 | 64 | IGNORES.add('_ctypes.pointer') |
|
65 | # pure Python module on PyPy, must be loaded to raise ModuleNotFoundError | |
|
66 | # on non-Windows platforms | |
|
67 | IGNORES.add('msvcrt') | |
|
65 | 68 | |
|
66 | 69 | demandimport.init(IGNORES) |
|
67 | 70 |
@@ -1338,10 +1338,12 b' def followlines(repo, subset, x):' | |||
|
1338 | 1338 | |
|
1339 | 1339 | @predicate(b'nodefromfile(path)') |
|
1340 | 1340 | def nodefromfile(repo, subset, x): |
|
1341 | """ | |
|
1342 | An alias for ``::.`` (ancestors of the working directory's first parent). | |
|
1343 | If file pattern is specified, the histories of files matching given | |
|
1344 | pattern in the revision given by startrev are followed, including copies. | |
|
1341 | """Read a list of nodes from the file at `path`. | |
|
1342 | ||
|
1343 | This applies `id(LINE)` to each line of the file. | |
|
1344 | ||
|
1345 | This is useful when the amount of nodes you need to specify gets too large | |
|
1346 | for the command line. | |
|
1345 | 1347 | """ |
|
1346 | 1348 | path = getstring(x, _(b"nodefromfile require a file path")) |
|
1347 | 1349 | listed_rev = set() |
@@ -12,7 +12,6 b' import base64' | |||
|
12 | 12 | import socket |
|
13 | 13 | |
|
14 | 14 | from .i18n import _ |
|
15 | from .pycompat import getattr | |
|
16 | 15 | from . import ( |
|
17 | 16 | encoding, |
|
18 | 17 | error, |
@@ -198,15 +197,6 b' class httpconnection(keepalive.HTTPConne' | |||
|
198 | 197 | # must be able to send big bundle as stream. |
|
199 | 198 | send = _gen_sendfile(keepalive.HTTPConnection.send) |
|
200 | 199 | |
|
201 | def getresponse(self): | |
|
202 | proxyres = getattr(self, 'proxyres', None) | |
|
203 | if proxyres: | |
|
204 | if proxyres.will_close: | |
|
205 | self.close() | |
|
206 | self.proxyres = None | |
|
207 | return proxyres | |
|
208 | return keepalive.HTTPConnection.getresponse(self) | |
|
209 | ||
|
210 | 200 | |
|
211 | 201 | # Large parts of this function have their origin from before Python 2.6 |
|
212 | 202 | # and could potentially be removed. |
@@ -255,77 +245,15 b' def _generic_proxytunnel(self):' | |||
|
255 | 245 | break |
|
256 | 246 | # skip lines that are all whitespace |
|
257 | 247 | list(iter(lambda: res.fp.readline().strip(), b'')) |
|
258 | res.status = status | |
|
259 | res.reason = reason.strip() | |
|
260 | 248 | |
|
261 |
if |
|
|
249 | if status == 200: | |
|
262 | 250 | # skip lines until we find a blank line |
|
263 | 251 | list(iter(res.fp.readline, b'\r\n')) |
|
264 | return True | |
|
265 | ||
|
266 | if version == b'HTTP/1.0': | |
|
267 | res.version = 10 | |
|
268 | elif version.startswith(b'HTTP/1.'): | |
|
269 | res.version = 11 | |
|
270 | elif version == b'HTTP/0.9': | |
|
271 | res.version = 9 | |
|
272 | 252 | else: |
|
273 | raise httplib.UnknownProtocol(version) | |
|
274 | ||
|
275 | if res.version == 9: | |
|
276 | res.length = None | |
|
277 | res.chunked = 0 | |
|
278 | res.will_close = 1 | |
|
279 | res.msg = httplib.HTTPMessage(stringio()) | |
|
280 | return False | |
|
281 | ||
|
282 | res.msg = httplib.HTTPMessage(res.fp) | |
|
283 | res.msg.fp = None | |
|
284 | ||
|
285 | # are we using the chunked-style of transfer encoding? | |
|
286 | trenc = res.msg.getheader(b'transfer-encoding') | |
|
287 | if trenc and trenc.lower() == b"chunked": | |
|
288 | res.chunked = 1 | |
|
289 | res.chunk_left = None | |
|
290 | else: | |
|
291 | res.chunked = 0 | |
|
292 | ||
|
293 | # will the connection close at the end of the response? | |
|
294 | res.will_close = res._check_close() | |
|
295 | ||
|
296 | # do we have a Content-Length? | |
|
297 | # NOTE: RFC 2616, section 4.4, #3 says we ignore this if | |
|
298 | # transfer-encoding is "chunked" | |
|
299 | length = res.msg.getheader(b'content-length') | |
|
300 | if length and not res.chunked: | |
|
301 | try: | |
|
302 | res.length = int(length) | |
|
303 | except ValueError: | |
|
304 | res.length = None | |
|
305 | else: | |
|
306 | if res.length < 0: # ignore nonsensical negative lengths | |
|
307 | res.length = None | |
|
308 | else: | |
|
309 | res.length = None | |
|
310 | ||
|
311 | # does the body have a fixed length? (of zero) | |
|
312 | if ( | |
|
313 | status == httplib.NO_CONTENT | |
|
314 | or status == httplib.NOT_MODIFIED | |
|
315 | or 100 <= status < 200 | |
|
316 | or res._method == b'HEAD' # 1xx codes | |
|
317 | ): | |
|
318 | res.length = 0 | |
|
319 | ||
|
320 | # if the connection remains open, and we aren't using chunked, and | |
|
321 | # a content-length was not provided, then assume that the connection | |
|
322 | # WILL close. | |
|
323 | if not res.will_close and not res.chunked and res.length is None: | |
|
324 | res.will_close = 1 | |
|
325 | ||
|
326 | self.proxyres = res | |
|
327 | ||
|
328 | return False | |
|
253 | self.close() | |
|
254 | raise socket.error( | |
|
255 | "Tunnel connection failed: %d %s" % (status, reason.strip()) | |
|
256 | ) | |
|
329 | 257 | |
|
330 | 258 | |
|
331 | 259 | class httphandler(keepalive.HTTPHandler): |
@@ -15,7 +15,7 b' byteorder = "1.4.3"' | |||
|
15 | 15 | derive_more = "0.99.17" |
|
16 | 16 | hashbrown = { version = "0.9.1", features = ["rayon"] } |
|
17 | 17 | home = "0.5.3" |
|
18 |
im-rc = "15.0 |
|
|
18 | im-rc = "15.0" | |
|
19 | 19 | itertools = "0.10.3" |
|
20 | 20 | lazy_static = "1.4.0" |
|
21 | 21 | libc = "0.2" |
@@ -1121,7 +1121,7 b' def has_emacs():' | |||
|
1121 | 1121 | @check('black', 'the black formatter for python (>= 20.8b1)') |
|
1122 | 1122 | def has_black(): |
|
1123 | 1123 | blackcmd = 'black --version' |
|
1124 | version_regex = b'black, version ([0-9a-b.]+)' | |
|
1124 | version_regex = b'black, (?:version )?([0-9a-b.]+)' | |
|
1125 | 1125 | version = matchoutput(blackcmd, version_regex) |
|
1126 | 1126 | sv = distutils.version.StrictVersion |
|
1127 | 1127 | return version and sv(_bytes2sys(version.group(1))) >= sv('20.8b1') |
@@ -104,6 +104,13 b' do not use the proxy if it is in the no ' | |||
|
104 | 104 | new changesets 83180e7845de |
|
105 | 105 | updating to branch default |
|
106 | 106 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | ||
|
108 | proxy can't connect to server | |
|
109 | ||
|
110 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT2/ h | |
|
111 | abort: HTTP Error 404: Connection refused | |
|
112 | [100] | |
|
113 | ||
|
107 | 114 | $ cat proxy.log |
|
108 | 115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
109 | 116 | $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
@@ -120,3 +127,5 b' do not use the proxy if it is in the no ' | |||
|
120 | 127 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) |
|
121 | 128 | $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
122 | 129 | $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
130 | * - - [*] code 404, message Connection refused (glob) | |
|
131 | $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT2/?cmd=capabilities HTTP/1.1" 404 - (glob) |
@@ -491,6 +491,13 b' Test https with cert problems through pr' | |||
|
491 | 491 | abort: error: *certificate verify failed* (glob) |
|
492 | 492 | [100] |
|
493 | 493 | |
|
494 | Test when proxy can't connect to server | |
|
495 | ||
|
496 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure https://localhost:0/ | |
|
497 | pulling from https://localhost:0/ | |
|
498 | abort: error: Tunnel connection failed: 404 Connection refused | |
|
499 | [100] | |
|
500 | ||
|
494 | 501 | |
|
495 | 502 | $ killdaemons.py hg0.pid |
|
496 | 503 |
@@ -73,12 +73,8 b' class ProxyHandler(httpserver.basehttpre' | |||
|
73 | 73 | print("\t" "connect to %s:%d" % host_port) |
|
74 | 74 | try: |
|
75 | 75 | soc.connect(host_port) |
|
76 |
except socket.error as |
|
|
77 | try: | |
|
78 | msg = arg[1] | |
|
79 | except (IndexError, TypeError): | |
|
80 | msg = arg | |
|
81 | self.send_error(404, msg) | |
|
76 | except socket.error as e: | |
|
77 | self.send_error(404, e.strerror) | |
|
82 | 78 | return 0 |
|
83 | 79 | return 1 |
|
84 | 80 |
General Comments 0
You need to be logged in to leave comments.
Login now