tests/test-duplicateoptions.py
changeset 14449 7d171c05a631
child 14762 6beb26747430
equal deleted inserted replaced
14448:7d367e8f892d 14449:7d171c05a631
       
     1 import os
       
     2 from mercurial import ui, commands, extensions
       
     3 
       
     4 ignore = set(['highlight', 'win32text'])
       
     5 
       
     6 if os.name != 'nt':
       
     7     ignore.add('win32mbcs')
       
     8 
       
     9 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
       
    10 
       
    11 hgrc = open(os.environ["HGRCPATH"], 'w')
       
    12 hgrc.write('[extensions]\n')
       
    13 
       
    14 for ext in disabled:
       
    15     hgrc.write(ext + '=\n')
       
    16 
       
    17 hgrc.close()
       
    18 
       
    19 u = ui.ui()
       
    20 extensions.loadall(u)
       
    21 
       
    22 for cmd, entry in commands.table.iteritems():
       
    23     seenshort = set()
       
    24     seenlong = set()
       
    25     for option in entry[1]:
       
    26         if (option[0] and option[0] in seenshort) or \
       
    27            (option[1] and option[1] in seenlong):
       
    28             print "command '" + cmd + "' has duplicate option " + str(option)
       
    29         seenshort.add(option[0])
       
    30         seenlong.add(option[1])