##// END OF EJS Templates
style: run a patched black on a subset of mercurial...
style: run a patched black on a subset of mercurial This applied black to the 20 smallest files in mercurial/: ls -S1 mercurial/*.py | tail -n20 | xargs black --skip-string-normalization Note that a few files failed to format, presumably due to a bug in my patch. The intent is to be able to compare results to D5064 with https://github.com/python/black/pull/826 applied to black. I skipped string normalization on this patch for clarity - in reality I think we'd want one pass without string normalization, followed by another to normalize strings (which is basically replacing ' with " globally.) # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6342

File last commit:

r37896:81455f48 default
r43345:57875cf4 default
Show More
test-hgwebdir-paths.py
48 lines | 1.2 KiB | text/x-python | PythonLexer
/ tests / test-hgwebdir-paths.py
from __future__ import absolute_import
import os
from mercurial import (
hg,
ui as uimod,
)
from mercurial.hgweb import (
hgwebdir_mod,
)
hgwebdir = hgwebdir_mod.hgwebdir
os.mkdir(b'webdir')
os.chdir(b'webdir')
webdir = os.path.realpath(b'.')
u = uimod.ui.load()
hg.repository(u, b'a', create=1)
hg.repository(u, b'b', create=1)
os.chdir(b'b')
hg.repository(u, b'd', create=1)
os.chdir(b'..')
hg.repository(u, b'c', create=1)
os.chdir(b'..')
paths = {b't/a/': b'%s/a' % webdir,
b'b': b'%s/b' % webdir,
b'coll': b'%s/*' % webdir,
b'rcoll': b'%s/**' % webdir}
config = os.path.join(webdir, b'hgwebdir.conf')
configfile = open(config, 'wb')
configfile.write(b'[paths]\n')
for k, v in paths.items():
configfile.write(b'%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