Mercurial > hg
comparison tests/test-extension-timing.t @ 39507:a5d6bf6032fb
extensions: add timing for extensions reposetup
Differential Revision: https://phab.mercurial-scm.org/D4509
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Sep 2018 19:36:25 -0700 |
parents | tests/test-extension.t@d7ac6dafc609 |
children | 1a2bfc4d756a |
comparison
equal
deleted
inserted
replaced
39506:b66ea3fc3a86 | 39507:a5d6bf6032fb |
---|---|
1 Test basic extension support | |
2 | |
3 $ cat > foobar.py <<EOF | |
4 > import os | |
5 > from mercurial import commands, registrar | |
6 > cmdtable = {} | |
7 > command = registrar.command(cmdtable) | |
8 > configtable = {} | |
9 > configitem = registrar.configitem(configtable) | |
10 > configitem(b'tests', b'foo', default=b"Foo") | |
11 > def uisetup(ui): | |
12 > ui.debug(b"uisetup called [debug]\\n") | |
13 > ui.write(b"uisetup called\\n") | |
14 > ui.status(b"uisetup called [status]\\n") | |
15 > ui.flush() | |
16 > def reposetup(ui, repo): | |
17 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) | |
18 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) | |
19 > ui.flush() | |
20 > @command(b'foo', [], b'hg foo') | |
21 > def foo(ui, *args, **kwargs): | |
22 > foo = ui.config(b'tests', b'foo') | |
23 > ui.write(foo) | |
24 > ui.write(b"\\n") | |
25 > @command(b'bar', [], b'hg bar', norepo=True) | |
26 > def bar(ui, *args, **kwargs): | |
27 > ui.write(b"Bar\\n") | |
28 > EOF | |
29 $ abspath=`pwd`/foobar.py | |
30 | |
31 $ mkdir barfoo | |
32 $ cp foobar.py barfoo/__init__.py | |
33 $ barfoopath=`pwd`/barfoo | |
34 | |
35 $ hg init a | |
36 $ cd a | |
37 $ echo foo > file | |
38 $ hg add file | |
39 $ hg commit -m 'add file' | |
40 | |
41 $ echo '[extensions]' >> $HGRCPATH | |
42 $ echo "foobar = $abspath" >> $HGRCPATH | |
43 | |
44 Test extension setup timings | |
45 | |
46 $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1 | |
47 debug.extensions: loading extensions | |
48 debug.extensions: - processing 1 entries | |
49 debug.extensions: - loading extension: 'foobar' | |
50 debug.extensions: > 'foobar' extension loaded in * (glob) | |
51 debug.extensions: - validating extension tables: 'foobar' | |
52 debug.extensions: - invoking registered callbacks: 'foobar' | |
53 debug.extensions: > callbacks completed in * (glob) | |
54 debug.extensions: > loaded 1 extensions, total time * (glob) | |
55 debug.extensions: - loading configtable attributes | |
56 debug.extensions: - executing uisetup hooks | |
57 debug.extensions: - running uisetup for 'foobar' | |
58 uisetup called [debug] | |
59 uisetup called | |
60 uisetup called [status] | |
61 debug.extensions: > uisetup for 'foobar' took * (glob) | |
62 debug.extensions: - executing extsetup hooks | |
63 debug.extensions: - running extsetup for 'foobar' | |
64 debug.extensions: > extsetup for 'foobar' took * (glob) | |
65 debug.extensions: - executing remaining aftercallbacks | |
66 debug.extensions: > remaining aftercallbacks completed in * (glob) | |
67 debug.extensions: - loading extension registration objects | |
68 debug.extensions: > extension registration object loading took * (glob) | |
69 debug.extensions: extension loading complete | |
70 debug.extensions: loading additional extensions | |
71 debug.extensions: - processing 1 entries | |
72 debug.extensions: > loaded 0 extensions, total time * (glob) | |
73 debug.extensions: - loading configtable attributes | |
74 debug.extensions: - executing uisetup hooks | |
75 debug.extensions: - executing extsetup hooks | |
76 debug.extensions: - executing remaining aftercallbacks | |
77 debug.extensions: > remaining aftercallbacks completed in * (glob) | |
78 debug.extensions: - loading extension registration objects | |
79 debug.extensions: > extension registration object loading took * (glob) | |
80 debug.extensions: extension loading complete | |
81 debug.extensions: - executing reposetup hooks | |
82 debug.extensions: - running reposetup for foobar | |
83 reposetup called for a | |
84 ui == repo.ui | |
85 debug.extensions: > reposetup for 'foobar' took * (glob) | |
86 Foo | |
87 | |
88 $ cd .. | |
89 | |
90 $ echo 'foobar = !' >> $HGRCPATH |