Patchwork D1967: wireprotoserver: don't import symbol from hgweb.common

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 8:19 p.m.
Message ID <differential-rev-PHID-DREV-xgx65vx5wbedtdxu6f4o-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27115/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2018, 8:19 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Importing hgweb.common requires importing hgweb.
  hgweb/__init__.py contains a bit of code and does imports of large
  parts of the hgweb.* module tree.
  
  All we need is a constant defining the integer status code for
  HTTP OK. So just redefine HTTP_OK in wireprotoserver.py and avoid
  the excessive imports.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1967

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -9,9 +9,6 @@ 
 import cgi
 import struct
 
-from .hgweb.common import (
-    HTTP_OK,
-)
 from . import (
     error,
     pycompat,
@@ -24,6 +21,8 @@ 
 urlerr = util.urlerr
 urlreq = util.urlreq
 
+HTTP_OK = 200
+
 HGTYPE = 'application/mercurial-0.1'
 HGTYPE2 = 'application/mercurial-0.2'
 HGERRTYPE = 'application/hg-error'