comparison tests/test-duplicateoptions.py @ 15099:b1f49efeab65

test: test for options duplicate with global options issue2995 should not happen anymore
author Simon Heimberg <simohe@besonet.ch>
date Wed, 14 Sep 2011 17:06:33 +0200
parents 6beb26747430
children f5dd179bfa4a
comparison
equal deleted inserted replaced
15098:edf7ae547b0e 15099:b1f49efeab65
17 hgrc.close() 17 hgrc.close()
18 18
19 u = ui.ui() 19 u = ui.ui()
20 extensions.loadall(u) 20 extensions.loadall(u)
21 21
22 globalshort = set()
23 globallong = set()
24 for option in commands.globalopts:
25 option[0] and globalshort.add(option[0])
26 option[1] and globallong.add(option[1])
27
22 for cmd, entry in commands.table.iteritems(): 28 for cmd, entry in commands.table.iteritems():
23 seenshort = set() 29 seenshort = globalshort.copy()
24 seenlong = set() 30 seenlong = globallong.copy()
25 for option in entry[1]: 31 for option in entry[1]:
26 if (option[0] and option[0] in seenshort) or \ 32 if (option[0] and option[0] in seenshort) or \
27 (option[1] and option[1] in seenlong): 33 (option[1] and option[1] in seenlong):
28 print "command '" + cmd + "' has duplicate option " + str(option) 34 print "command '" + cmd + "' has duplicate option " + str(option)
29 seenshort.add(option[0]) 35 seenshort.add(option[0])