##// END OF EJS Templates
global: mass rewrite to use modern exception syntax...
global: mass rewrite to use modern exception syntax Python 2.6 introduced the "except type as instance" syntax, replacing the "except type, instance" syntax that came before. Python 3 dropped support for the latter syntax. Since we no longer support Python 2.4 or 2.5, we have no need to continue supporting the "except type, instance". This patch mass rewrites the exception syntax to be Python 2.6+ and Python 3 compatible. This patch was produced by running `2to3 -f except -w -n .`.

File last commit:

r15381:c519cd8f stable
r25660:328739ea default
Show More
test-hgwebdir-paths.py
40 lines | 1.0 KiB | text/x-python | PythonLexer
/ tests / test-hgwebdir-paths.py
Jeremy Whitlock
hgweb: make hgwebdir handle dict/list paths the same as config paths...
r8529 import os
Matt Mackall
backout dbdb777502dc (issue3077) (issue3071)...
r15381 from mercurial import hg, ui
Jeremy Whitlock
hgweb: make hgwebdir handle dict/list paths the same as config paths...
r8529 from mercurial.hgweb.hgwebdir_mod import hgwebdir
os.mkdir('webdir')
os.chdir('webdir')
Matt Mackall
backout dbdb777502dc (issue3077) (issue3071)...
r15381 webdir = os.path.realpath('.')
Jeremy Whitlock
hgweb: make hgwebdir handle dict/list paths the same as config paths...
r8529
u = ui.ui()
hg.repository(u, 'a', create=1)
hg.repository(u, 'b', create=1)
os.chdir('b')
hg.repository(u, 'd', create=1)
os.chdir('..')
hg.repository(u, 'c', create=1)
os.chdir('..')
paths = {'t/a/': '%s/a' % webdir,
'b': '%s/b' % webdir,
'coll': '%s/*' % webdir,
'rcoll': '%s/**' % webdir}
config = os.path.join(webdir, 'hgwebdir.conf')
configfile = open(config, 'w')
configfile.write('[paths]\n')
for k, v in paths.items():
configfile.write('%s = %s\n' % (k, v))
configfile.close()
confwd = hgwebdir(config)
dictwd = hgwebdir(paths)
assert len(confwd.repos) == len(dictwd.repos), 'different numbers'
assert len(confwd.repos) == 9, 'expected 9 repos, found %d' % len(confwd.repos)
found = dict(confwd.repos)
for key, path in dictwd.repos:
assert key in found, 'repository %s was not found' % key
assert found[key] == path, 'different paths for repo %s' % key