Mercurial > hg
view README @ 27583:37d50250b696
registrar: add funcregistrar class to register function for specific purpose
This class centralizes the common logic to register function for
specific purpose like below:
- template keyword, filter and function
- revset predicate
- fileset predicate
- webcommand
'funcregistrar' also formats help document of the function with the
'decl'(aration) specified at the construction.
This can avoid (1) redundancy between 'decl' and help document, and
(2) accidental typo of help document. For example, 'foo' should appear
twice like below, if without such formatting:
@keyword('foo')
def foo(....):
""":foo: Explanation of keyword foo ..."""
Almost all cases needs very simple document formatting like below:
- "``DECL``\n EXPLANATION"
- ":DECL: EXPLANATION"
But webcommand needs a little complicated formatting like:
/PATH/SPEC
----------
EXPLANATION ....
To make minirst recognize the section header, hyphen line should be as
long as "/PATH/SPEC". It should be arranged by program.
Implementing 'formatdoc()' in derived class can support complicated
formatting in the latter case. But it seems redundant for simple one
in the former case.
Therefore, 'funcregistrar' does:
- invoke 'self.formatdoc', if it is callable (for the latter case)
- use it as the format string, otherwise (for the former case)
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 29 Dec 2015 23:58:30 +0900 |
parents | 4b0fc75f9403 |
children | 76b171209151 |
line wrap: on
line source
Mercurial ========= Mercurial is a fast, easy to use, distributed revision control tool for software developers. Basic install: $ make # see install targets $ make install # do a system-wide install $ hg debuginstall # sanity-check setup $ hg # see help Running without installing: $ make local # build for inplace usage $ ./hg --version # should show the latest version See https://mercurial-scm.org/ for detailed installation instructions, platform-specific notes, and Mercurial user information.