comparison mercurial/hgweb/webcommands.py @ 24088:fe3ee31b039f

webcommands: document "file" web command
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 06 Feb 2015 21:26:53 -0800
parents 6f5b4393590c
children f17773432782
comparison
equal deleted inserted replaced
24087:6f5b4393590c 24088:fe3ee31b039f
129 rename=webutil.renamelink(fctx), 129 rename=webutil.renamelink(fctx),
130 permissions=fctx.manifest().flags(f)) 130 permissions=fctx.manifest().flags(f))
131 131
132 @webcommand('file') 132 @webcommand('file')
133 def file(web, req, tmpl): 133 def file(web, req, tmpl):
134 """
135 /file/{revision}[/{path}]
136 -------------------------
137
138 Show information about a directory or file in the repository.
139
140 Info about the ``path`` given as a URL parameter will be rendered.
141
142 If ``path`` is a directory, information about the entries in that
143 directory will be rendered. This form is equivalent to the ``manifest``
144 handler.
145
146 If ``path`` is a file, information about that file will be shown via
147 the ``filerevision`` template.
148
149 If ``path`` is not defined, information about the root directory will
150 be rendered.
151 """
134 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) 152 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0])
135 if not path: 153 if not path:
136 return manifest(web, req, tmpl) 154 return manifest(web, req, tmpl)
137 try: 155 try:
138 return _filerevision(web, tmpl, webutil.filectx(web.repo, req)) 156 return _filerevision(web, tmpl, webutil.filectx(web.repo, req))