Mercurial > repos > rnateam > nastiseq
Help: hgweb
Configuring hgweb
Mercurial's internal web server, hgweb, can serve either a single repository, or a tree of repositories. In the second case, repository paths and global options can be defined using a dedicated configuration file common to 'hg serve', "hgweb.wsgi", "hgweb.cgi" and "hgweb.fcgi".
This file uses the same syntax as other Mercurial configuration files but recognizes only the following sections:
- web
- paths
- collections
The "web" options are thoroughly described in 'hg help config'.
The "paths" section maps URL paths to paths of repositories in the filesystem. hgweb will not expose the filesystem directly - only Mercurial repositories can be published and only according to the configuration.
The left hand side is the path in the URL. Note that hgweb reserves subpaths like "rev" or "file", try using different names for nested repositories to avoid confusing effects.
The right hand side is the path in the filesystem. If the specified path ends with "*" or "**" the filesystem will be searched recursively for repositories below that point. With "*" it will not recurse into the repositories it finds (except for ".hg/patches"). With "**" it will also search inside repository working directories and possibly find subrepositories.
In this example:
[paths] /projects/a = /srv/tmprepos/a /projects/b = c:/repos/b / = /srv/repos/* /user/bob = /home/bob/repos/**
- The first two entries make two repositories in different directories appear under the same directory in the web interface
- The third entry will publish every Mercurial repository found in "/srv/repos/", for instance the repository "/srv/repos/quux/" will appear as "http://server/quux/"
- The fourth entry will publish both "http://server/user/bob/quux/" and "http://server/user/bob/quux/testsubrepo/"
The "collections" section is deprecated and has been superseded by "paths".
URLs and Common Arguments
URLs under each repository have the form "/{command}[/{arguments}]" where "{command}" represents the name of a command or handler and "{arguments}" represents any number of additional URL parameters to that command.
The web server has a default style associated with it. Styles map to a collection of named templates. Each template is used to render a specific piece of data, such as a changeset or diff.
The style for the current request can be overridden two ways. First, if "{command}" contains a hyphen ("-"), the text before the hyphen defines the style. For example, "/atom-log" will render the "log" command handler with the "atom" style. The second way to set the style is with the "style" query string argument. For example, "/log?style=atom". The hyphenated URL parameter is preferred.
Not all templates are available for all styles. Attempting to use a style that doesn't have all templates defined may result in an error rendering the page.
Many commands take a "{revision}" URL parameter. This defines the changeset to operate on. This is commonly specified as the short, 12 digit hexadecimal abbreviation for the full 40 character unique revision identifier. However, any value described by 'hg help revisions' typically works.
Commands and URLs
The following web commands and their URLs are available:
/annotate/{revision}/{path}
Show changeset information for each line in a file.
The "ignorews", "ignorewsamount", "ignorewseol", and "ignoreblanklines" query string arguments have the same meaning as their "[annotate]" config equivalents. It uses the hgrc boolean parsing logic to interpret the value. e.g. "0" and "false" are false and "1" and "true" are true. If not defined, the server default settings are used.
The "fileannotate" template is rendered.
/archive/{revision}.{format}[/{path}]
Obtain an archive of repository content.
The content and type of the archive is defined by a URL path parameter. "format" is the file extension of the archive type to be generated. e.g. "zip" or "tar.bz2". Not all archive types may be allowed by your server configuration.
The optional "path" URL parameter controls content to include in the archive. If omitted, every file in the specified revision is present in the archive. If included, only the specified file or contents of the specified directory will be included in the archive.
No template is used for this handler. Raw, binary content is generated.
/bookmarks
Show information about bookmarks.
No arguments are accepted.
The "bookmarks" template is rendered.
/branches
Show information about branches.
All known branches are contained in the output, even closed branches.
No arguments are accepted.
The "branches" template is rendered.
/changelog[/{revision}]
Show information about multiple changesets.
If the optional "revision" URL argument is absent, information about all changesets starting at "tip" will be rendered. If the "revision" argument is present, changesets will be shown starting from the specified revision.
If "revision" is absent, the "rev" query string argument may be defined. This will perform a search for changesets.
The argument for "rev" can be a single revision, a revision set, or a literal keyword to search for in changeset data (equivalent to 'hg log -k').
The "revcount" query string argument defines the maximum numbers of changesets to render.
For non-searches, the "changelog" template will be rendered.
/changeset[/{revision}]
Show information about a single changeset.
A URL path argument is the changeset identifier to show. See "hg help revisions" for possible values. If not defined, the "tip" changeset will be shown.
The "changeset" template is rendered. Contents of the "changesettag", "changesetbookmark", "filenodelink", "filenolink", and the many templates related to diffs may all be used to produce the output.
/comparison/{revision}/{path}
Show a comparison between the old and new versions of a file from changes made on a particular revision.
This is similar to the "diff" handler. However, this form features a split or side-by-side diff rather than a unified diff.
The "context" query string argument can be used to control the lines of context in the diff.
The "filecomparison" template is rendered.
/diff/{revision}/{path}
Show how a file changed in a particular commit.
The "filediff" template is rendered.
This handler is registered under both the "/diff" and "/filediff" paths. "/diff" is used in modern code.
/file/{revision}[/{path}]
Show information about a directory or file in the repository.
Info about the "path" given as a URL parameter will be rendered.
If "path" is a directory, information about the entries in that directory will be rendered. This form is equivalent to the "manifest" handler.
If "path" is a file, information about that file will be shown via the "filerevision" template.
If "path" is not defined, information about the root directory will be rendered.
/diff/{revision}/{path}
Show how a file changed in a particular commit.
The "filediff" template is rendered.
This handler is registered under both the "/diff" and "/filediff" paths. "/diff" is used in modern code.
/filelog/{revision}/{path}
Show information about the history of a file in the repository.
The "revcount" query string argument can be defined to control the maximum number of entries to show.
The "filelog" template will be rendered.
/graph[/{revision}]
Show information about the graphical topology of the repository.
Information rendered by this handler can be used to create visual representations of repository topology.
The "revision" URL parameter controls the starting changeset. If it's absent, the default is "tip".
The "revcount" query string argument can define the number of changesets to show information for.
The "graphtop" query string argument can specify the starting changeset for producing "jsdata" variable that is used for rendering graph in JavaScript. By default it has the same value as "revision".
This handler will render the "graph" template.
/help[/{topic}]
Render help documentation.
This web command is roughly equivalent to 'hg help'. If a "topic" is defined, that help topic will be rendered. If not, an index of available help topics will be rendered.
The "help" template will be rendered when requesting help for a topic. "helptopics" will be rendered for the index of help topics.
/log[/{revision}[/{path}]]
Show repository or file history.
For URLs of the form "/log/{revision}", a list of changesets starting at the specified changeset identifier is shown. If "{revision}" is not defined, the default is "tip". This form is equivalent to the "changelog" handler.
For URLs of the form "/log/{revision}/{file}", the history for a specific file will be shown. This form is equivalent to the "filelog" handler.
/manifest[/{revision}[/{path}]]
Show information about a directory.
If the URL path arguments are omitted, information about the root directory for the "tip" changeset will be shown.
Because this handler can only show information for directories, it is recommended to use the "file" handler instead, as it can handle both directories and files.
The "manifest" template will be rendered for this handler.
/changeset[/{revision}]
Show information about a single changeset.
A URL path argument is the changeset identifier to show. See "hg help revisions" for possible values. If not defined, the "tip" changeset will be shown.
The "changeset" template is rendered. Contents of the "changesettag", "changesetbookmark", "filenodelink", "filenolink", and the many templates related to diffs may all be used to produce the output.
/shortlog
Show basic information about a set of changesets.
This accepts the same parameters as the "changelog" handler. The only difference is the "shortlog" template will be rendered instead of the "changelog" template.
/summary
Show a summary of repository state.
Information about the latest changesets, bookmarks, tags, and branches is captured by this handler.
The "summary" template is rendered.
/tags
Show information about tags.
No arguments are accepted.
The "tags" template is rendered.