Patchwork extensions: indicate loaded for an immediately called afterload callback

login
register
mail settings
Submitter Matt Harbison
Date Feb. 22, 2015, 5:34 p.m.
Message ID <6e555df5c9f23a601df8.1424626484@Envy>
Download mbox | patch
Permalink /patch/7818/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 22, 2015, 5:34 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1424497218 18000
#      Sat Feb 21 00:40:18 2015 -0500
# Node ID 6e555df5c9f23a601df8f511ba29efb17b9bdce3
# Parent  ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
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.
Augie Fackler - Feb. 25, 2015, 2:38 p.m.
On Sun, Feb 22, 2015 at 12:34:44PM -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1424497218 18000
> #      Sat Feb 21 00:40:18 2015 -0500
> # Node ID 6e555df5c9f23a601df8f511ba29efb17b9bdce3
> # Parent  ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
> extensions: indicate loaded for an immediately called afterload callback

Queued, thanks.

>
> 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.
>
> diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> --- a/mercurial/extensions.py
> +++ b/mercurial/extensions.py
> @@ -148,7 +148,7 @@
>      '''
>
>      if extension in _extensions:
> -        callback(loaded=False)
> +        callback(loaded=True)
>      else:
>          _aftercallbacks.setdefault(extension, []).append(callback)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -148,7 +148,7 @@ 
     '''
 
     if extension in _extensions:
-        callback(loaded=False)
+        callback(loaded=True)
     else:
         _aftercallbacks.setdefault(extension, []).append(callback)