##// END OF EJS Templates
test-duplicateoptions: alias ui as uimod
Yuya Nishihara -
r28804:ce49c8d4 default
parent child Browse files
Show More
@@ -1,41 +1,41
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2 import os
2 import os
3 from mercurial import (
3 from mercurial import (
4 commands,
4 commands,
5 extensions,
5 extensions,
6 ui,
6 ui as uimod,
7 )
7 )
8
8
9 ignore = set(['highlight', 'win32text', 'factotum'])
9 ignore = set(['highlight', 'win32text', 'factotum'])
10
10
11 if os.name != 'nt':
11 if os.name != 'nt':
12 ignore.add('win32mbcs')
12 ignore.add('win32mbcs')
13
13
14 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
14 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
15
15
16 hgrc = open(os.environ["HGRCPATH"], 'w')
16 hgrc = open(os.environ["HGRCPATH"], 'w')
17 hgrc.write('[extensions]\n')
17 hgrc.write('[extensions]\n')
18
18
19 for ext in disabled:
19 for ext in disabled:
20 hgrc.write(ext + '=\n')
20 hgrc.write(ext + '=\n')
21
21
22 hgrc.close()
22 hgrc.close()
23
23
24 u = ui.ui()
24 u = uimod.ui()
25 extensions.loadall(u)
25 extensions.loadall(u)
26
26
27 globalshort = set()
27 globalshort = set()
28 globallong = set()
28 globallong = set()
29 for option in commands.globalopts:
29 for option in commands.globalopts:
30 option[0] and globalshort.add(option[0])
30 option[0] and globalshort.add(option[0])
31 option[1] and globallong.add(option[1])
31 option[1] and globallong.add(option[1])
32
32
33 for cmd, entry in commands.table.iteritems():
33 for cmd, entry in commands.table.iteritems():
34 seenshort = globalshort.copy()
34 seenshort = globalshort.copy()
35 seenlong = globallong.copy()
35 seenlong = globallong.copy()
36 for option in entry[1]:
36 for option in entry[1]:
37 if (option[0] and option[0] in seenshort) or \
37 if (option[0] and option[0] in seenshort) or \
38 (option[1] and option[1] in seenlong):
38 (option[1] and option[1] in seenlong):
39 print("command '" + cmd + "' has duplicate option " + str(option))
39 print("command '" + cmd + "' has duplicate option " + str(option))
40 seenshort.add(option[0])
40 seenshort.add(option[0])
41 seenlong.add(option[1])
41 seenlong.add(option[1])
General Comments 0
You need to be logged in to leave comments. Login now