[PATCH 13 of 15] Example FastCGI hgweb script

vincent at ricardis.tudelft.nl vincent at ricardis.tudelft.nl
Wed Aug 24 16:49:21 CDT 2005


Patch subject is complete summary.


# HG changeset patch
# User Vincent Wagelaar <vincent at ricardis.tudelft.nl>
# Node ID bf9f130d6fb2a3cb7d059d1a3dbf0235f1958b79
# Parent  d4383e2b77951df1466a776bccffaa628467166a
Example FastCGI hgweb script

diff -r d4383e2b7795 -r bf9f130d6fb2 hgweb.fcgi
--- /dev/null	Tue Aug 23 22:34:41 2005
+++ b/hgweb.fcgi	Tue Aug 23 22:36:37 2005
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+#
+# An example FastCGI script to use hgweb, edit as necessary
+
+from mercurial import hgweb
+from mercurial import thfcgi
+
+web = hgweb.hgweb("/path/to/repository")
+def handle_req(req, env, form):
+    global web
+    try:
+        web.run(req.stdin, req.out, env)
+        req.finish()
+    except SystemExit:
+        pass
+    except:
+        # You should probably log tracebacks here
+        pass
+
+
+if __name__ == "__main__":
+    fcgi = thfcgi.THFCGI(handle_req)
+    fcgi.run()
+        
\ No newline at end of file


More information about the Mercurial mailing list