mercurial/hgweb/webcommands.py
changeset 38062 17f7b44367bb
parent 38061 d3b4c4769b5c
child 38063 3c995af3066e
equal deleted inserted replaced
38061:d3b4c4769b5c 38062:17f7b44367bb
   554             h[None] = None # denotes files present
   554             h[None] = None # denotes files present
   555 
   555 
   556     if mf and not files and not dirs:
   556     if mf and not files and not dirs:
   557         raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
   557         raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
   558 
   558 
   559     def filelist(**map):
   559     def filelist(context):
   560         for f in sorted(files):
   560         for f in sorted(files):
   561             full = files[f]
   561             full = files[f]
   562 
   562 
   563             fctx = ctx.filectx(full)
   563             fctx = ctx.filectx(full)
   564             yield {"file": full,
   564             yield {"file": full,
   566                    "basename": f,
   566                    "basename": f,
   567                    "date": fctx.date(),
   567                    "date": fctx.date(),
   568                    "size": fctx.size(),
   568                    "size": fctx.size(),
   569                    "permissions": mf.flags(full)}
   569                    "permissions": mf.flags(full)}
   570 
   570 
   571     def dirlist(**map):
   571     def dirlist(context):
   572         for d in sorted(dirs):
   572         for d in sorted(dirs):
   573 
   573 
   574             emptydirs = []
   574             emptydirs = []
   575             h = dirs[d]
   575             h = dirs[d]
   576             while isinstance(h, dict) and len(h) == 1:
   576             while isinstance(h, dict) and len(h) == 1:
   589         'manifest',
   589         'manifest',
   590         symrev=symrev,
   590         symrev=symrev,
   591         path=abspath,
   591         path=abspath,
   592         up=webutil.up(abspath),
   592         up=webutil.up(abspath),
   593         upparity=next(parity),
   593         upparity=next(parity),
   594         fentries=filelist,
   594         fentries=templateutil.mappinggenerator(filelist),
   595         dentries=dirlist,
   595         dentries=templateutil.mappinggenerator(dirlist),
   596         archives=web.archivelist(hex(node)),
   596         archives=web.archivelist(hex(node)),
   597         **pycompat.strkwargs(webutil.commonentry(web.repo, ctx)))
   597         **pycompat.strkwargs(webutil.commonentry(web.repo, ctx)))
   598 
   598 
   599 @webcommand('tags')
   599 @webcommand('tags')
   600 def tags(web):
   600 def tags(web):