view tests/test-hgwebdir-paths.py @ 24882:995003a324da stable

bundlerepo: disable filtering of changelog while constructing revision text This avoids the following error that happened if base revision of bundle file was hidden. bundlerevlog needs it to construct revision texts from bundle content as revlog.revision() does. File "mercurial/context.py", line 485, in _changeset return self._repo.changelog.read(self.rev()) File "mercurial/changelog.py", line 319, in read text = self.revision(node) File "mercurial/bundlerepo.py", line 124, in revision text = self.baserevision(iterrev) File "mercurial/bundlerepo.py", line 160, in baserevision return changelog.changelog.revision(self, nodeorrev) File "mercurial/revlog.py", line 1041, in revision node = self.node(rev) File "mercurial/changelog.py", line 211, in node raise error.FilteredIndexError(rev) mercurial.error.FilteredIndexError: 1
author Yuya Nishihara <yuya@tcha.org>
date Wed, 29 Apr 2015 19:47:37 +0900
parents c519cd8f0169
children 4eac86331acb
line wrap: on
line source

import os
from mercurial import hg, ui
from mercurial.hgweb.hgwebdir_mod import hgwebdir

os.mkdir('webdir')
os.chdir('webdir')

webdir = os.path.realpath('.')

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