sapling/tests/test-extension-inline.t
Jun Wu 037caa0b04 extension: support inlined extensions
Summary:
This diff adds support for extension source code inlined into configuration.

The main intended use case is to use Chef to quickly deploy config changes.
The config change can be inlined extensions that patch broken logic.
Since extensions are more powerful than pure config changes, we gain the
ability to hotfix more complicated issues.

In theory, Chef can also write files to the filesystem. It's less convenient
because different OSes might require different paths, cleaning them up might
be extra work.

Reviewed By: ikostia

Differential Revision: D15073429

fbshipit-source-id: 7696bdce72bf7222debc72002173feb7de95198f
2019-04-29 13:52:19 -07:00

14 lines
424 B
Raku

$ cat >> foo.py << EOF
> from edenscm.mercurial import registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command('foo', [], norepo=True)
> def foo(ui):
> ui.write('This is the foo command\n')
> EOF
$ setconfig "extensions.foo=python-base64:`python -c 'import base64; print(base64.encodestring(open(\"foo.py\").read()).replace(\"\\n\",\"\"))'`"
$ hg foo
This is the foo command