mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
e0e01cbc81
Summary: This broke a bunch of tests. Revert it and re-enable all the tests. Reviewed By: DurhamG Differential Revision: D19665042 fbshipit-source-id: c3c17e3ac7e2ea028be5b5836bc8349cdf56184e
52 lines
1.5 KiB
Perl
52 lines
1.5 KiB
Perl
Test namespace registration using registrar
|
|
|
|
$ shorttraceback
|
|
|
|
$ newrepo
|
|
$ newext << EOF
|
|
> from edenscm.mercurial import registrar, namespaces
|
|
> namespacepredicate = registrar.namespacepredicate()
|
|
> @namespacepredicate("a", priority=60)
|
|
> def a(_repo):
|
|
> return namespaces.namespace()
|
|
> @namespacepredicate("b", priority=70)
|
|
> def b(_repo):
|
|
> return None
|
|
> @namespacepredicate("c", priority=50)
|
|
> def c(_repo):
|
|
> return namespaces.namespace()
|
|
> EOF
|
|
|
|
$ hg debugshell -c "ui.write('%s\n' % str(list(repo.names)))"
|
|
['bookmarks', 'branches', 'c', 'a']
|
|
|
|
$ newext << EOF
|
|
> from edenscm.mercurial import registrar, namespaces
|
|
> namespacepredicate = registrar.namespacepredicate()
|
|
> @namespacepredicate("z", priority=99)
|
|
> def z(_repo):
|
|
> return namespaces.namespace()
|
|
> @namespacepredicate("d", priority=15)
|
|
> def d(_repo):
|
|
> return namespaces.namespace()
|
|
> EOF
|
|
$ hg debugshell -c "ui.write('%s\n' % str(list(repo.names)))"
|
|
['bookmarks', 'd', 'branches', 'c', 'a', 'z']
|
|
|
|
Test that not specifying the priority will result in failure to load the
|
|
extension.
|
|
|
|
$ newext << EOF
|
|
> from edenscm.mercurial import registrar, namespaces
|
|
> namespacepredicate = registrar.namespacepredicate()
|
|
> @namespacepredicate("x", priority=None)
|
|
> def z(_repo):
|
|
> return namespaces.namespace()
|
|
> EOF
|
|
|
|
|
|
- Run any command to test that the extension loading failed.
|
|
|
|
$ hg status
|
|
warning: extension ext3 is disabled because it cannot be imported from $TESTTMP/ext3.py: namespace priority must be specified
|