[PATCH 10 of 10] hgweb: drop references to deprecated cgitb
Mads Kiilerich
mads at kiilerich.com
Wed Jun 28 00:06:55 UTC 2023
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1687795228 -7200
# Mon Jun 26 18:00:28 2023 +0200
# Branch stable
# Node ID 6ca3c985d3fe233bde88057e1a04f6c2c5ab71fd
# Parent 5a32d6ab784657d51dc02c9e86ad92d4efd21ee8
hgweb: drop references to deprecated cgitb
cgitb is going away and gives warnings when importing, and that make tests
fail:
$TESTTMP/hgweb.cgi:5: DeprecationWarning: 'cgitb' is deprecated and slated for removal in Python 3.13
The lack of a "nice" high level error handler is not a huge problem, neither
for users (where it is disabled anyway) or for tests (where we don't use a
browser and the plain tracebacks often are more readable). It is inevitable
that it is going away, and there is no obvious alternative. Remove it and move
on.
diff --git a/contrib/hgweb.fcgi b/contrib/hgweb.fcgi
--- a/contrib/hgweb.fcgi
+++ b/contrib/hgweb.fcgi
@@ -9,9 +9,6 @@ config = b"/path/to/repo/or/config"
# (consult "installed modules" path from 'hg debuginstall'):
# import sys; sys.path.insert(0, "/path/to/python/lib")
-# Uncomment to send python tracebacks to the browser if an error occurs:
-# import cgitb; cgitb.enable()
-
from mercurial import demandimport
demandimport.enable()
diff --git a/contrib/hgweb.wsgi b/contrib/hgweb.wsgi
--- a/contrib/hgweb.wsgi
+++ b/contrib/hgweb.wsgi
@@ -8,9 +8,6 @@ config = b"/path/to/repo/or/config"
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
-# Uncomment to send python tracebacks to the browser if an error occurs:
-#import cgitb; cgitb.enable()
-
# enable demandloading to reduce startup time
from mercurial import demandimport; demandimport.enable()
diff --git a/hgweb.cgi b/hgweb.cgi
--- a/hgweb.cgi
+++ b/hgweb.cgi
@@ -10,9 +10,6 @@ config = b"/path/to/repo/or/config"
# (consult "installed modules" path from 'hg debuginstall'):
# import sys; sys.path.insert(0, "/path/to/python/lib")
-# Uncomment to send python tracebacks to the browser if an error occurs:
-# import cgitb; cgitb.enable()
-
from mercurial import demandimport
demandimport.enable()
diff --git a/tests/test-clone-cgi.t b/tests/test-clone-cgi.t
--- a/tests/test-clone-cgi.t
+++ b/tests/test-clone-cgi.t
@@ -12,8 +12,6 @@ initialize repository
$ cat >hgweb.cgi <<HGWEB
> #
> # An example CGI script to use hgweb, edit as necessary
- > import cgitb
- > cgitb.enable()
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb
> from mercurial.hgweb import wsgicgi
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1581,8 +1581,6 @@ Test that secret mq patch does not break
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb
> from mercurial.hgweb import wsgicgi
- > import cgitb
- > cgitb.enable()
> app = hgweb(b'.', b'test')
> wsgicgi.launch(app)
> HGWEB
diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t
--- a/tests/test-newcgi.t
+++ b/tests/test-newcgi.t
@@ -9,9 +9,6 @@ before d74fc8dec2b4 still work.
> #
> # An example CGI script to use hgweb, edit as necessary
>
- > import cgitb
- > cgitb.enable()
- >
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb
> from mercurial.hgweb import wsgicgi
@@ -35,9 +32,6 @@ before d74fc8dec2b4 still work.
> #
> # An example CGI script to export multiple hgweb repos, edit as necessary
>
- > import cgitb
- > cgitb.enable()
- >
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgwebdir
> from mercurial.hgweb import wsgicgi
diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t
--- a/tests/test-newercgi.t
+++ b/tests/test-newercgi.t
@@ -9,9 +9,6 @@ This is a rudimentary test of the CGI fi
> #
> # An example CGI script to use hgweb, edit as necessary
>
- > import cgitb
- > cgitb.enable()
- >
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb
> from mercurial.hgweb import wsgicgi
@@ -32,9 +29,6 @@ This is a rudimentary test of the CGI fi
> #
> # An example CGI script to export multiple hgweb repos, edit as necessary
>
- > import cgitb
- > cgitb.enable()
- >
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgwebdir
> from mercurial.hgweb import wsgicgi
diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t
--- a/tests/test-oldcgi.t
+++ b/tests/test-oldcgi.t
@@ -8,8 +8,7 @@ This tests if CGI files from before d0db
> #
> # An example CGI script to use hgweb, edit as necessary
>
- > import cgitb, os, sys
- > cgitb.enable()
+ > import os, sys
>
> # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
> from mercurial import hgweb
@@ -30,8 +29,7 @@ This tests if CGI files from before d0db
> #
> # An example CGI script to export multiple hgweb repos, edit as necessary
>
- > import cgitb, sys
- > cgitb.enable()
+ > import sys
>
> # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
> from mercurial import hgweb
diff --git a/tests/test-push-cgi.t b/tests/test-push-cgi.t
--- a/tests/test-push-cgi.t
+++ b/tests/test-push-cgi.t
@@ -16,8 +16,6 @@ initialize repository
create hgweb invocation script
$ cat >hgweb.cgi <<HGWEB
- > import cgitb
- > cgitb.enable()
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb
> from mercurial.hgweb import wsgicgi
More information about the Mercurial-devel
mailing list