Mercurial > hg
comparison mercurial/extensions.py @ 33014:80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
If an extension was loaded but disabled due to a minimumhgversion check it
will be present in the _extensions map, but set to None. The rest of the
extensions code treats the extension as if it were not present in this case,
but the afterloaded() function called the callback with loaded=True.
author | Adam Simpkins <simpkins@fb.com> |
---|---|
date | Fri, 23 Jun 2017 10:59:05 -0700 |
parents | ea1c2eb7abd3 |
children | 45b0e9d05ee9 |
comparison
equal
deleted
inserted
replaced
33013:9c242e9fca65 | 33014:80a5d237a4ae |
---|---|
255 The callback receives the named argument ``loaded``, which is a boolean | 255 The callback receives the named argument ``loaded``, which is a boolean |
256 indicating whether the dependent extension actually loaded. | 256 indicating whether the dependent extension actually loaded. |
257 ''' | 257 ''' |
258 | 258 |
259 if extension in _extensions: | 259 if extension in _extensions: |
260 callback(loaded=True) | 260 # Report loaded as False if the extension is disabled |
261 loaded = (_extensions[extension] is not None) | |
262 callback(loaded=loaded) | |
261 else: | 263 else: |
262 _aftercallbacks.setdefault(extension, []).append(callback) | 264 _aftercallbacks.setdefault(extension, []).append(callback) |
263 | 265 |
264 def bind(func, *args): | 266 def bind(func, *args): |
265 '''Partial function application | 267 '''Partial function application |