def run(self): if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): raise RuntimeError( "This function is only intended to be called while running as a CGI script." ) import mercurial.hgweb.wsgicgi as wsgicgi wsgicgi.launch(self)
def run(self): """Start a server from CGI environment. Modern servers should be using WSGI and should avoid this method, if possible. """ if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): raise RuntimeError("This function is only intended to be " "called while running as a CGI script.") import mercurial.hgweb.wsgicgi as wsgicgi wsgicgi.launch(self)
def run(self): if not os.environ.get("GATEWAY_INTERFACE", "").startswith("CGI/1."): raise RuntimeError("This function is only intended to be " "called while running as a CGI script.") import mercurial.hgweb.wsgicgi as wsgicgi wsgicgi.launch(self)
import os from mercurial import demandimport, ui as uimod, hg from mercurial.hgweb import hgweb, wsgicgi demandimport.enable() try: u = uimod.ui.load() except AttributeError: # For installations earlier than Mercurial 4.1 u = uimod.ui() u.setconfig('web', 'push_ssl', 'false') u.setconfig('web', 'allow_read', '*') u.setconfig('web', 'allow_push', '*') u.setconfig('hooks', 'changegroup.scm', 'python:scmhooks.postHook') u.setconfig('hooks', 'pretxnchangegroup.scm', 'python:scmhooks.preHook') # pass SCM_HTTP_POST_ARGS to enable experimental httppostargs protocol of mercurial # SCM_HTTP_POST_ARGS is set by HgCGIServlet # Issue 970: https://goo.gl/poascp u.setconfig('experimental', 'httppostargs', os.environ['SCM_HTTP_POST_ARGS']) # open repository # SCM_REPOSITORY_PATH contains the repository path and is set by HgCGIServlet r = hg.repository(u, os.environ['SCM_REPOSITORY_PATH']) application = hgweb(r) wsgicgi.launch(application)
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # http://bitbucket.org/sdorra/scm-manager # # import os, sys pythonPath = os.environ['SCM_PYTHON_PATH'] if len(pythonPath) > 0: pathParts = pythonPath.split(os.pathsep) for i in range(len(pathParts)): sys.path.insert(i, pathParts[i]) repositoryPath = os.environ['SCM_REPOSITORY_PATH'] from mercurial import demandimport; demandimport.enable() from mercurial.hgweb import hgweb, wsgicgi application = hgweb(repositoryPath) wsgicgi.launch(application)
def cgiserve(ui, repo, **opts): application = hgweb(repo) wsgicgi.launch(application)