hgext/evolve.py
changeset 1441 a4abe588d77f
parent 1440 afe46c3b15db
child 1442 6a219f8089f9
equal deleted inserted replaced
1440:afe46c3b15db 1441:a4abe588d77f
   401     # Unregister evolve commands if the command capability is not specified.
   401     # Unregister evolve commands if the command capability is not specified.
   402     #
   402     #
   403     # This must be in the same function as the option configuration above to
   403     # This must be in the same function as the option configuration above to
   404     # guarantee it happens after the above configuration, but before the
   404     # guarantee it happens after the above configuration, but before the
   405     # extsetup functions.
   405     # extsetup functions.
       
   406     evolvecommands = ui.configlist('experimental', 'evolutioncommands')
   406     evolveopts = ui.configlist('experimental', 'evolution')
   407     evolveopts = ui.configlist('experimental', 'evolution')
   407     if evolveopts and (commandopt not in evolveopts and
   408     if evolveopts and (commandopt not in evolveopts and
   408                        'all' not in evolveopts):
   409                        'all' not in evolveopts):
   409         cmdtable.clear()
   410         # We build whitelist containing the commands we want to enable
       
   411         whitelist = set()
       
   412         for cmd in evolvecommands:
       
   413             matchingevolvecommands = [e for e in cmdtable.keys() if cmd in e]
       
   414             if not matchingevolvecommands:
       
   415                 raise error.Abort(_('unknown command: %s') % cmd)
       
   416             elif len(matchingevolvecommands) > 1:
       
   417                 raise error.Abort(_('ambiguous command specification: %s') % cmd)
       
   418             else:
       
   419                 whitelist.add(matchingevolvecommands[0])
       
   420         for disabledcmd in set(cmdtable) - whitelist:
       
   421             del cmdtable[disabledcmd]
   410 
   422 
   411 #####################################################################
   423 #####################################################################
   412 ### experimental behavior                                         ###
   424 ### experimental behavior                                         ###
   413 #####################################################################
   425 #####################################################################
   414 
   426