# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1507936186 -7200
#      Sat Oct 14 01:09:46 2017 +0200
# Node ID bdea558e769aa4e8565f8de48610feaa6f8c0534
# Parent  637d309714d8f4e9b25479eef1ad5c6de418a004
# EXP-Topic config.register.ready
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
bdea558e769a
eol: ensure the eol extensions is loaded when hooks run

Similar to the change we did to the 'acl' extensions, we want to make sure the
config items are registered before we run the hooks.

diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -244,8 +244,22 @@
                   "at %s: %s\n") % (inst.args[1], inst.args[0]))
     return None
 
+def ensureenabled(ui):
+    """make sure the extension is enabled when used as hook
+
+    When eol is used through hooks, the extension is never formally loaded and
+    enabled. This has some side effect, for example the config declaration is
+    never loaded. This function ensure the extension is enabled when running
+    hooks.
+    """
+    if 'eol' in ui._knownconfig:
+        return
+    ui.setconfig('extensions', 'eol', '', source='internal')
+    extensions.loadall(ui, ['eol'])
+
 def _checkhook(ui, repo, node, headsonly):
     # Get revisions to check and touched files at the same time
+    ensureenabled(ui)
     files = set()
     revs = set()
     for rev in xrange(repo[node].rev(), len(repo)):
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to