##// END OF EJS Templates
wireproto: support /api/* URL space for exposing APIs...
wireproto: support /api/* URL space for exposing APIs I will soon be introducing a new version of the HTTP wire protocol. One of the things I want to change with it is the URL routing. I want to rely on URL paths to define endpoints rather than the "cmd" query string argument. That should be pretty straightforward. I was thinking about what URL space to reserve for the new protocol. We /could/ put everything at a top-level path. e.g. /wireproto/* or /http-v2-wireproto/*. However, these constrain us a bit because they assume there will only be 1 API: version 2 of the HTTP wire protocol. I think there is room to grow multiple APIs. For example, there may someday be a proper JSON API to query or even manipulate the repository. And I don't think we should have to create a new top-level URL space for each API nor should we attempt to shoehorn each future API into the same shared URL space: that would just be too chaotic. This commits reserves the /api/* URL space for all our future API needs. Essentially, all requests to /api/* get routed to a new WSGI handler. By default, it 404's the entire URL space unless the "api server" feature is enabled. When enabled, requests to "/api" list available APIs. URLs of the form /api/<name>/* are reserved for a particular named API. Behavior within each API is left up to that API. So, we can grow new APIs easily without worrying about URL space conflicts. APIs can be registered by adding entries to a global dict. This allows extensions to provide their own APIs should they choose to do so. This is probably a premature feature. But IMO the code is easier to read if we're not dealing with API-specific behavior like config option querying inline. To prove it works, we implement a very basic API for version 2 of the HTTP wire protocol. It does nothing of value except facilitate testing of the /api/* URL space. We currently emit plain text responses for all /api/* endpoints. There's definitely room to look at Accept and other request headers to vary the response format. But we have to start somewhere. Differential Revision: https://phab.mercurial-scm.org/D2834

File last commit:

r35187:aef2b98d merge default
r37064:1cfef569 default
Show More
environment.txt
121 lines | 4.2 KiB | text/plain | TextLexer
HG
Path to the 'hg' executable, automatically passed when running
hooks, extensions or external tools. If unset or empty, this is
the hg executable's name if it's frozen, or an executable named
'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on
Windows) is searched.
HGEDITOR
This is the name of the editor to run when committing. See EDITOR.
(deprecated, see :hg:`help config.ui.editor`)
HGENCODING
This overrides the default locale setting detected by Mercurial.
This setting is used to convert data including usernames,
changeset descriptions, tag names, and branches. This setting can
be overridden with the --encoding command-line option.
HGENCODINGMODE
This sets Mercurial's behavior for handling unknown characters
while transcoding user input. The default is "strict", which
causes Mercurial to abort if it can't map a character. Other
settings include "replace", which replaces unknown characters, and
"ignore", which drops them. This setting can be overridden with
the --encodingmode command-line option.
HGENCODINGAMBIGUOUS
This sets Mercurial's behavior for handling characters with
"ambiguous" widths like accented Latin characters with East Asian
fonts. By default, Mercurial assumes ambiguous characters are
narrow, set this variable to "wide" if such characters cause
formatting problems.
HGMERGE
An executable to use for resolving merge conflicts. The program
will be executed with three arguments: local file, remote file,
ancestor file.
(deprecated, see :hg:`help config.ui.merge`)
HGRCPATH
A list of files or directories to search for configuration
files. Item separator is ":" on Unix, ";" on Windows. If HGRCPATH
is not set, platform default search path is used. If empty, only
the .hg/hgrc from the current repository is read.
For each element in HGRCPATH:
- if it's a directory, all files ending with .rc are added
- otherwise, the file itself will be added
HGPLAIN
When set, this disables any configuration settings that might
change Mercurial's default output. This includes encoding,
defaults, verbose mode, debug mode, quiet mode, tracebacks, and
localization. This can be useful when scripting against Mercurial
in the face of existing user configuration.
In addition to the features disabled by ``HGPLAIN=``, the following
values can be specified to adjust behavior:
``+strictflags``
Restrict parsing of command line flags.
Equivalent options set via command line flags or environment
variables are not overridden.
See :hg:`help scripting` for details.
HGPLAINEXCEPT
This is a comma-separated list of features to preserve when
HGPLAIN is enabled. Currently the following values are supported:
``alias``
Don't remove aliases.
``color``
Don't disable colored output.
``i18n``
Preserve internationalization.
``revsetalias``
Don't remove revset aliases.
``templatealias``
Don't remove template aliases.
``progress``
Don't hide progress output.
Setting HGPLAINEXCEPT to anything (even an empty string) will
enable plain mode.
HGUSER
This is the string used as the author of a commit. If not set,
available values will be considered in this order:
- HGUSER (deprecated)
- configuration files from the HGRCPATH
- EMAIL
- interactive prompt
- LOGNAME (with ``@hostname`` appended)
(deprecated, see :hg:`help config.ui.username`)
EMAIL
May be used as the author of a commit; see HGUSER.
LOGNAME
May be used as the author of a commit; see HGUSER.
VISUAL
This is the name of the editor to use when committing. See EDITOR.
EDITOR
Sometimes Mercurial needs to open a text file in an editor for a
user to modify, for example when writing commit messages. The
editor it uses is determined by looking at the environment
variables HGEDITOR, VISUAL and EDITOR, in that order. The first
non-empty one is chosen. If all of them are empty, the editor
defaults to 'vi'.
PYTHONPATH
This is used by Python to find imported modules and may need to be
set appropriately if this Mercurial is not installed system-wide.