sapling/eden/scm/tests/test-namespaces.t
Durham Goode 9778811573 tags: remove tags feature
Summary:
We no longer user tags in any of our repositories, so let's delete all
the code and remove some tech debt.

Previously drawdag was our last remaining use of tags, but in a previous diff I
switched that to use bookmarks.

Reviewed By: quark-zju

Differential Revision: D19042226

fbshipit-source-id: d7871c71c1026599aa70fdd806418347ea214a8a
2020-01-07 12:31:10 -08:00

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