2016-04-03 16:58:43 +03:00
|
|
|
from __future__ import absolute_import, print_function
|
2011-05-27 18:51:16 +04:00
|
|
|
import os
|
2016-04-03 16:56:15 +03:00
|
|
|
from mercurial import (
|
|
|
|
commands,
|
|
|
|
extensions,
|
2016-04-05 17:17:05 +03:00
|
|
|
ui as uimod,
|
2016-04-03 16:56:15 +03:00
|
|
|
)
|
2011-05-27 18:51:16 +04:00
|
|
|
|
2018-01-09 01:35:01 +03:00
|
|
|
ignore = {b'highlight', b'win32text', b'factotum', b'remotenames',
|
2018-01-09 19:18:14 +03:00
|
|
|
b'lz4revlog', b'hgsql', b'shelve', b'fbconduit', b''}
|
2011-05-27 18:51:16 +04:00
|
|
|
|
|
|
|
if os.name != 'nt':
|
2017-07-26 05:53:44 +03:00
|
|
|
ignore.add(b'win32mbcs')
|
2011-05-27 18:51:16 +04:00
|
|
|
|
|
|
|
disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
|
|
|
|
|
2017-07-26 05:53:44 +03:00
|
|
|
hgrc = open(os.environ["HGRCPATH"], 'wb')
|
|
|
|
hgrc.write(b'[extensions]\n')
|
2011-05-27 18:51:16 +04:00
|
|
|
|
|
|
|
for ext in disabled:
|
2017-07-26 05:53:44 +03:00
|
|
|
hgrc.write(ext + b'=\n')
|
2011-05-27 18:51:16 +04:00
|
|
|
|
|
|
|
hgrc.close()
|
|
|
|
|
2016-10-22 08:35:10 +03:00
|
|
|
u = uimod.ui.load()
|
2018-01-09 19:18:14 +03:00
|
|
|
|
|
|
|
# Some extensions may print useful warning messages when they are loaded without
|
|
|
|
# the necessary config options. Let's capture that output since it does not
|
|
|
|
# matter for this test.
|
|
|
|
u.pushbuffer(error=True)
|
2011-05-27 18:51:16 +04:00
|
|
|
extensions.loadall(u)
|
2018-01-09 19:18:14 +03:00
|
|
|
u.popbuffer()
|
2011-05-27 18:51:16 +04:00
|
|
|
|
2011-09-14 19:06:33 +04:00
|
|
|
globalshort = set()
|
|
|
|
globallong = set()
|
|
|
|
for option in commands.globalopts:
|
|
|
|
option[0] and globalshort.add(option[0])
|
|
|
|
option[1] and globallong.add(option[1])
|
|
|
|
|
2017-07-26 05:53:44 +03:00
|
|
|
for cmd, entry in commands.table.items():
|
2011-09-14 19:06:33 +04:00
|
|
|
seenshort = globalshort.copy()
|
|
|
|
seenlong = globallong.copy()
|
2011-05-27 18:51:16 +04:00
|
|
|
for option in entry[1]:
|
|
|
|
if (option[0] and option[0] in seenshort) or \
|
|
|
|
(option[1] and option[1] in seenlong):
|
2016-04-03 16:58:43 +03:00
|
|
|
print("command '" + cmd + "' has duplicate option " + str(option))
|
2011-05-27 18:51:16 +04:00
|
|
|
seenshort.add(option[0])
|
|
|
|
seenlong.add(option[1])
|