comparison mercurial/help/internals/extensions.txt @ 40596:252396a6a3f2

help: merge section about uisetup() and extsetup() They are technically the same callback, called only once per process. The section name "ui setup" is confusing, so shouldn't be used.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 12 Nov 2018 22:26:24 +0900
parents 419d703115b0
children 04d08f17ce7a
comparison
equal deleted inserted replaced
40595:419d703115b0 40596:252396a6a3f2
149 Extensions are loaded in phases. All extensions are processed in a given phase 149 Extensions are loaded in phases. All extensions are processed in a given phase
150 before the next phase begins. In the first phase, all extension modules are 150 before the next phase begins. In the first phase, all extension modules are
151 loaded and registered with Mercurial. This means that you can find all enabled 151 loaded and registered with Mercurial. This means that you can find all enabled
152 extensions with ``extensions.find`` in the following phases. 152 extensions with ``extensions.find`` in the following phases.
153 153
154 ui setup 154 Extension setup
155 -------- 155 ---------------
156 156
157 Extensions can implement an optional callback named ``uisetup``. ``uisetup`` 157 There are two callbacks to be called when extensions are loaded, named
158 is called when the extension is first loaded and receives a ui object:: 158 ``uisetup`` and ``extsetup``. ``uisetup`` is called first for each extension,
159 then ``extsetup`` is called. This means ``extsetup`` can be useful in case
160 one extension optionally depends on another extension.
161
162 Both ``uisetup`` and ``extsetup`` receive a ui object::
159 163
160 def uisetup(ui): 164 def uisetup(ui):
161 # ... 165 # ...
162 166
163 Extension setup
164 ---------------
165
166 Extensions can implement an optional callback named ``extsetup``. It is
167 called after all the extension are loaded, and can be useful in case one
168 extension optionally depends on another extension. Signature::
169
170 def extsetup():
171 # ...
172
173 Mercurial version 8e6019b16a7d and later (that is post-1.3.1) will pass
174 a ``ui``` argument to ``extsetup``::
175
176 def extsetup(ui): 167 def extsetup(ui):
177 # ... 168 # ...
169
170 In Mercurial 1.3.1 or earlier, ``extsetup`` takes no argument.
178 171
179 Command table setup 172 Command table setup
180 ------------------- 173 -------------------
181 174
182 After ``extsetup``, the ``cmdtable`` is copied into the global command table 175 After ``extsetup``, the ``cmdtable`` is copied into the global command table