windows: use normalized path as path to subrepo
path to subrepo is used to identify or check location of subrepo.
it should be normalized (in "/" delimiter form), because it is also
used with narrowmatcher which uses only normalized path even on
Windows environment.
this patch applies "util.pconvert()" on path to subrepo (called
"subpath") to normalize it.
for this patch, referers of below were checked.
- subrepo.state()
- subrepo.itersubrepos()
- subrepo.subrepo()
- context.sub()
- context.substate()
typical usecase is:
for subpath in ctx.substate:
sub = ctx.sub(subpath)
... ctx.substate[subpath] ....
in this case, normalization has no side effect, because keys given
from substate are used as key itself.
other cases shown below also seem to require subpath to be normalized.
- path components are joined by "/", in "commands.forget()":
for subpath in ctx.substate:
subforget[subpath + '/' + fsub] = (fsub, sub)
- normalized "file" is used to check below condition, in
"commands.revert()", "localrepository.commit()", and
"localrepository._checknested()"
file in ctx.substate
- substate.keys() is passed to dirstate.walk()/status() which use
only normalized pathes
import os
from mercurial import ui, commands, extensions
ignore = set(['highlight', 'inotify', 'win32text'])
if os.name != 'nt':
ignore.add('win32mbcs')
disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore]
hgrc = open(os.environ["HGRCPATH"], 'w')
hgrc.write('[extensions]\n')
for ext in disabled:
hgrc.write(ext + '=\n')
hgrc.close()
u = ui.ui()
extensions.loadall(u)
globalshort = set()
globallong = set()
for option in commands.globalopts:
option[0] and globalshort.add(option[0])
option[1] and globallong.add(option[1])
for cmd, entry in commands.table.iteritems():
seenshort = globalshort.copy()
seenlong = globallong.copy()
for option in entry[1]:
if (option[0] and option[0] in seenshort) or \
(option[1] and option[1] in seenlong):
print "command '" + cmd + "' has duplicate option " + str(option)
seenshort.add(option[0])
seenlong.add(option[1])