hgext/eol.py
changeset 34830 60802bba1090
parent 34134 d4a5193332b3
child 36696 bcfc4e3b6548
equal deleted inserted replaced
34829:120c5c155ba4 34830:60802bba1090
   242     except errormod.ParseError as inst:
   242     except errormod.ParseError as inst:
   243         ui.warn(_("warning: ignoring .hgeol file due to parse error "
   243         ui.warn(_("warning: ignoring .hgeol file due to parse error "
   244                   "at %s: %s\n") % (inst.args[1], inst.args[0]))
   244                   "at %s: %s\n") % (inst.args[1], inst.args[0]))
   245     return None
   245     return None
   246 
   246 
       
   247 def ensureenabled(ui):
       
   248     """make sure the extension is enabled when used as hook
       
   249 
       
   250     When eol is used through hooks, the extension is never formally loaded and
       
   251     enabled. This has some side effect, for example the config declaration is
       
   252     never loaded. This function ensure the extension is enabled when running
       
   253     hooks.
       
   254     """
       
   255     if 'eol' in ui._knownconfig:
       
   256         return
       
   257     ui.setconfig('extensions', 'eol', '', source='internal')
       
   258     extensions.loadall(ui, ['eol'])
       
   259 
   247 def _checkhook(ui, repo, node, headsonly):
   260 def _checkhook(ui, repo, node, headsonly):
   248     # Get revisions to check and touched files at the same time
   261     # Get revisions to check and touched files at the same time
       
   262     ensureenabled(ui)
   249     files = set()
   263     files = set()
   250     revs = set()
   264     revs = set()
   251     for rev in xrange(repo[node].rev(), len(repo)):
   265     for rev in xrange(repo[node].rev(), len(repo)):
   252         revs.add(rev)
   266         revs.add(rev)
   253         if headsonly:
   267         if headsonly: