largefiles: make sure debugstate command is populated before wrapping stable
authorYuya Nishihara <yuya@tcha.org>
Thu, 04 May 2017 15:23:51 +0900
branchstable
changeset 32185 1b27e1793156
parent 32179 247bb7a2c492
child 32194 9a86d936670f
largefiles: make sure debugstate command is populated before wrapping Copied the hack from 869d660b8669, which seemed the simplest workaround. Perhaps debugcommands.py should have its own commands table.
hgext/largefiles/uisetup.py
tests/test-largefiles.t
--- a/hgext/largefiles/uisetup.py	Sat May 06 02:33:00 2017 +0900
+++ b/hgext/largefiles/uisetup.py	Thu May 04 15:23:51 2017 +0900
@@ -21,6 +21,7 @@
     cmdutil,
     commands,
     copies,
+    debugcommands,
     exchange,
     extensions,
     filemerge,
@@ -39,6 +40,11 @@
 )
 
 def uisetup(ui):
+    # TODO: debugcommands should use a separate command table
+    # Side-effect of accessing is debugcommands module is guaranteed to be
+    # imported and commands.table is populated.
+    debugcommands.command
+
     # Disable auto-status for some commands which assume that all
     # files in the result are under Mercurial's control
 
--- a/tests/test-largefiles.t	Sat May 06 02:33:00 2017 +0900
+++ b/tests/test-largefiles.t	Thu May 04 15:23:51 2017 +0900
@@ -212,6 +212,25 @@
   $ killdaemons.py
 #endif
 
+Test largefiles can be loaded in hgweb (wrapcommand() shouldn't fail)
+
+  $ cat <<EOF > "$TESTTMP/hgweb.cgi"
+  > #!/usr/bin/env python
+  > from mercurial import demandimport; demandimport.enable()
+  > from mercurial.hgweb import hgweb
+  > from mercurial.hgweb import wsgicgi
+  > application = hgweb('.', 'test repo')
+  > wsgicgi.launch(application)
+  > EOF
+
+  $ PATH_INFO='/' \
+  > QUERY_STRING='' \
+  > REQUEST_METHOD='GET' \
+  > SCRIPT_NAME='' \
+  > SERVER_NAME='localhost' \
+  > SERVER_PORT='80' \
+  > python "$TESTTMP/hgweb.cgi" > /dev/null
+
 Test archiving the various revisions.  These hit corner cases known with
 archiving.