hgweb: fix a crash when using web.archivesubrepos stable
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 05 Nov 2014 21:33:45 -0500
branchstable
changeset 23232 a0ccb66f344d
parent 23231 32dadb2637f4
child 23244 18cc87e4375a
child 23245 d33a90cb2a32
hgweb: fix a crash when using web.archivesubrepos A matcher is required when enabling the subrepo option on archival.archive(), because that calls match.narrowmatcher(), which accesses fields on the object. It's therefore probably a bad idea to default the matcher to None on archive(), but that's a fix for default.
mercurial/hgweb/webcommands.py
tests/test-archive.t
--- a/mercurial/hgweb/webcommands.py	Wed Nov 05 20:31:58 2014 -0500
+++ b/mercurial/hgweb/webcommands.py	Wed Nov 05 21:33:45 2014 -0500
@@ -901,7 +901,7 @@
 
     ctx = webutil.changectx(web.repo, req)
     pats = []
-    matchfn = None
+    matchfn = scmutil.match(ctx, [])
     file = req.form.get('file', None)
     if file:
         pats = ['path:' + file[0]]
--- a/tests/test-archive.t	Wed Nov 05 20:31:58 2014 -0500
+++ b/tests/test-archive.t	Wed Nov 05 21:33:45 2014 -0500
@@ -20,6 +20,7 @@
   $ hg ci -m "add subrepo"
   $ echo "[web]" >> .hg/hgrc
   $ echo "name = test-archive" >> .hg/hgrc
+  $ echo "archivesubrepos = True" >> .hg/hgrc
   $ cp .hg/hgrc .hg/hgrc-base
   > test_archtype() {
   >     echo "allow_archive = $1" >> .hg/hgrc
@@ -95,6 +96,7 @@
   test-archive-1701ef1f1510/bar
   test-archive-1701ef1f1510/baz/bletch
   test-archive-1701ef1f1510/foo
+  test-archive-1701ef1f1510/subrepo/sub
   $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
   test-archive-1701ef1f1510/.hg_archival.txt
   test-archive-1701ef1f1510/.hgsub
@@ -102,6 +104,7 @@
   test-archive-1701ef1f1510/bar
   test-archive-1701ef1f1510/baz/bletch
   test-archive-1701ef1f1510/foo
+  test-archive-1701ef1f1510/subrepo/sub
   $ python getarchive.py "$TIP" zip > archive.zip
   $ unzip -t archive.zip
   Archive:  archive.zip
@@ -111,6 +114,7 @@
       testing: test-archive-1701ef1f1510/bar   OK
       testing: test-archive-1701ef1f1510/baz/bletch   OK
       testing: test-archive-1701ef1f1510/foo   OK
+      testing: test-archive-1701ef1f1510/subrepo/sub   OK
   No errors detected in compressed data of archive.zip.
 
 test that we can download single directories and files