[PATCH 6 of 7] hgweb: wrap {fentries} and {dentries} of manifest with mappinggenerator
Yuya Nishihara
yuya at tcha.org
Sat May 12 23:20:03 EDT 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1522840459 -32400
# Wed Apr 04 20:14:19 2018 +0900
# Node ID a4560b4d1b0ea2d1c81e0ac0baca0e0ce2070557
# Parent fbec01b4ef2287ede8255e14ac42ac3e6ef79906
hgweb: wrap {fentries} and {dentries} of manifest with mappinggenerator
They were functions returning a generator of mappings.
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -562,7 +562,7 @@ def manifest(web):
if mf and not files and not dirs:
raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
- def filelist(**map):
+ def filelist(context):
for f in sorted(files):
full = files[f]
@@ -574,7 +574,7 @@ def manifest(web):
"size": fctx.size(),
"permissions": mf.flags(full)}
- def dirlist(**map):
+ def dirlist(context):
for d in sorted(dirs):
emptydirs = []
@@ -597,8 +597,8 @@ def manifest(web):
path=abspath,
up=webutil.up(abspath),
upparity=next(parity),
- fentries=filelist,
- dentries=dirlist,
+ fentries=templateutil.mappinggenerator(filelist),
+ dentries=templateutil.mappinggenerator(dirlist),
archives=web.archivelist(hex(node)),
**pycompat.strkwargs(webutil.commonentry(web.repo, ctx)))
More information about the Mercurial-devel
mailing list