sapling/eden/scm/tests/test-namespaces.t
Muir Manders 1bcc7abff8 tests: enable rust status for debugruntest tests
Summary:
The new status doesn't work w/ legacy repos, so the tests need to be migrated. For each test, first I tried migrating to eagerepo, but in many cases that didn't work. Next I tried a remotefilelog repo (AKA "newclientrepo"). If I still couldn't get the test to work I just disabled rust status. This was mostly in tests that disabled treemanifest or were explicitly coupled with revlogs somehow.

Some tests had acute "hg status" discrepancies, so I left a FIXME(status) and disabled rust status.

I added a new "eagerepo" tinit.sh function that turns on eager format (for client repos). With this, tests doing "hg init" might just work with features that expect a modern repo.

Reviewed By: quark-zju

Differential Revision: D43839499

fbshipit-source-id: ce6d3b2747b90d31bd246c30551bdb55c446112f
2023-03-16 10:58:55 -07:00

53 lines
1.6 KiB
Perl

#debugruntest-compatible
Test namespace registration using registrar
$ shorttraceback
$ newrepo
$ newext << EOF
> from edenscm 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', 'remotebookmarks', 'a']
$ newext << EOF
> from edenscm 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', 'remotebookmarks', 'a', 'z']
Test that not specifying the priority will result in failure to load the
extension.
$ newext << EOF
> from edenscm 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 files || true
warning: extension ext3 is disabled because it cannot be imported from $TESTTMP/ext3.py: namespace priority must be specified