Anonymous avatar Anonymous committed 715440e

hgweb's internal workings have changed for serving HTTP.

Thanks to Mark Williamson <mark.williamson@cl.cam.ac.uk>; for the initial
patch.

Comments (0)

Files changed (1)

 import re
 import shutil
 
-from mercurial import cmdutil, commands, hg, node, util
+from mercurial import cmdutil, commands, hg, hgweb, node, util
 from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo
-from mercurial.hgweb import hgweb_mod
 from mercurial.i18n import gettext as _
 from mercurial.repo import RepoError
 
             return url, (revs or None)
 
 
+# For backwards compatibility, find the HTTP protocol.
+if not hasattr(hgweb, 'protocol'):
+    hgweb.protocol = hgweb.hgweb_mod.hgweb
+
 def cmd_options(ui, cmd, remove=None, table=commands.table):
     aliases, spec = findcmd(ui, cmd, table)
     res = list(spec[1])
     req.httphdr("application/mercurial-0.1", length=len(resp))
     req.write(resp)
 
-hgweb_mod.hgweb.do_capabilities = _httpserver_do_capabilities
+hgweb.protocol.do_capabilities = _httpserver_do_capabilities
 
 
 def _httpserver_do_forests(self, req):
     req.write(resp)
 
 
-hgweb_mod.hgweb.do_forests = _httpserver_do_forests
+hgweb.protocol.do_forests = _httpserver_do_forests
 
 
 def _statichttprepo_forests(self, walkhg):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.