[PATCH 7 of 7] get-with-headers: handle httplib py3 divergence

timeless timeless at fmr.im
Wed May 11 01:20:29 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1462561726 0
#      Fri May 06 19:08:46 2016 +0000
# Node ID a2806b270837492edb52a1146c12d9c1b5deed6d
# Parent  6849a6b26ea35775c142b78802b6b943dd2adf68
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r a2806b270837
get-with-headers: handle httplib py3 divergence

With this final change, get-with-headers.py works in Python 3

diff -r 6849a6b26ea3 -r a2806b270837 tests/get-with-headers.py
--- a/tests/get-with-headers.py	Fri May 06 19:07:23 2016 +0000
+++ b/tests/get-with-headers.py	Fri May 06 19:08:46 2016 +0000
@@ -5,12 +5,17 @@
 
 from __future__ import absolute_import, print_function
 
-import httplib
 import json
 import os
 import sys
 
 try:
+    import httplib
+    httplib.HTTPException
+except ImportError:
+    import http.client as httplib
+
+try:
     import msvcrt
     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
     msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)


More information about the Mercurial-devel mailing list