comparison mercurial/extensions.py @ 24145:28af978c8f13

extensions: indicate loaded for an immediately called afterload callback Otherwise, there's no way to tell between the immediate callback when it is already loaded, and when the extension is not loaded at all.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 21 Feb 2015 00:40:18 -0500
parents 042d95beeee8
children fb6cb1b82f4f
comparison
equal deleted inserted replaced
24144:a35b59d4df33 24145:28af978c8f13
146 The callback receives the named argument ``loaded``, which is a boolean 146 The callback receives the named argument ``loaded``, which is a boolean
147 indicating whether the dependent extension actually loaded. 147 indicating whether the dependent extension actually loaded.
148 ''' 148 '''
149 149
150 if extension in _extensions: 150 if extension in _extensions:
151 callback(loaded=False) 151 callback(loaded=True)
152 else: 152 else:
153 _aftercallbacks.setdefault(extension, []).append(callback) 153 _aftercallbacks.setdefault(extension, []).append(callback)
154 154
155 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): 155 def wrapcommand(table, command, wrapper, synopsis=None, docstring=None):
156 '''Wrap the command named `command' in table 156 '''Wrap the command named `command' in table