sapling/eden/hg-server/tests/test-extensions-afterloaded.t
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

116 lines
3.0 KiB
Perl

#chg-compatible
Test the extensions.afterloaded() function
$ cat > foo.py <<EOF
> from edenscm.mercurial import extensions
> def uisetup(ui):
> ui.write("foo.uisetup\\n")
> ui.flush()
> def bar_loaded(loaded):
> ui.write("foo: bar loaded: %r\\n" % (loaded,))
> ui.flush()
> extensions.afterloaded('bar', bar_loaded)
> EOF
$ cat > bar.py <<EOF
> def uisetup(ui):
> ui.write("bar.uisetup\\n")
> ui.flush()
> EOF
$ basepath=`pwd`
$ hg init basic
$ cd basic
$ echo foo > file
$ hg add file
$ hg commit -m 'add file'
$ echo '[extensions]' >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ echo "bar = $basepath/bar.py" >> .hg/hgrc
$ hg log -r. -T'{node}\n'
foo.uisetup
foo: bar loaded: True
bar.uisetup
c24b9ac61126c9cd86d5d684f8408cdc717005a4
Test afterloaded with the opposite extension load order
$ cd ..
$ hg init basic_reverse
$ cd basic_reverse
$ echo foo > file
$ hg add file
$ hg commit -m 'add file'
$ echo '[extensions]' >> .hg/hgrc
$ echo "bar = $basepath/bar.py" >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ hg log -r. -T'{node}\n'
bar.uisetup
foo.uisetup
foo: bar loaded: True
c24b9ac61126c9cd86d5d684f8408cdc717005a4
Test the extensions.afterloaded() function when the requested extension is not
loaded
$ cd ..
$ hg init notloaded
$ cd notloaded
$ echo foo > file
$ hg add file
$ hg commit -m 'add file'
$ echo '[extensions]' >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ hg log -r. -T'{node}\n'
foo.uisetup
foo: bar loaded: False
c24b9ac61126c9cd86d5d684f8408cdc717005a4
Test the extensions.afterloaded() function when the requested extension is not
configured but fails the minimum version check
$ cd ..
$ cat > minvers.py <<EOF
> minimumhgversion = '9999.9999'
> def uisetup(ui):
> ui.write("minvers.uisetup\\n")
> ui.flush()
> EOF
$ hg init minversion
$ cd minversion
$ echo foo > file
$ hg add file
$ hg commit -m 'add file'
$ echo '[extensions]' >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ echo "bar = $basepath/minvers.py" >> .hg/hgrc
$ hg log -r. -T'{node}\n'
(third party extension bar requires version 9999.9999 or newer of Mercurial; disabling)
foo.uisetup
foo: bar loaded: False
c24b9ac61126c9cd86d5d684f8408cdc717005a4
Test the extensions.afterloaded() function when the requested extension is not
configured but fails the minimum version check, using the opposite load order
for the two extensions.
$ cd ..
$ hg init minversion_reverse
$ cd minversion_reverse
$ echo foo > file
$ hg add file
$ hg commit -m 'add file'
$ echo '[extensions]' >> .hg/hgrc
$ echo "bar = $basepath/minvers.py" >> .hg/hgrc
$ echo "foo = $basepath/foo.py" >> .hg/hgrc
$ hg log -r. -T'{node}\n'
(third party extension bar requires version 9999.9999 or newer of Mercurial; disabling)
foo.uisetup
foo: bar loaded: False
c24b9ac61126c9cd86d5d684f8408cdc717005a4