Mercurial > hg-stable
annotate tests/revnamesext.py @ 41071:28a4fb793ba1
extensions: deprecate extsetup without a `ui` argument (API)
9.5 years should be enough time, but there were some tests for the old style
still (which are now updated). Exthelper doesn't fallback to the old API, so
this is for consistency.
.. api::
The extension hook ``extsetup`` without a `ui` argument has been deprecated,
and will be removed in the next version. Add a `ui` argument to avoid the
deprecation warning.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 27 Dec 2018 21:46:03 -0500 |
parents | 086fc71fbb09 |
children | 2372284d9457 |
rev | line source |
---|---|
33060
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # Dummy extension to define a namespace containing revision names |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 from __future__ import absolute_import |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 from mercurial import ( |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 namespaces, |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 ) |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 def reposetup(ui, repo): |
36577
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
33060
diff
changeset
|
10 names = {b'r%d' % rev: repo[rev].node() for rev in repo} |
33060
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 namemap = lambda r, name: names.get(name) |
36577
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
33060
diff
changeset
|
12 nodemap = lambda r, node: [b'r%d' % repo[node].rev()] |
33060
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 |
36577
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
33060
diff
changeset
|
14 ns = namespaces.namespace(b'revnames', templatename=b'revname', |
086fc71fbb09
py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents:
33060
diff
changeset
|
15 logname=b'revname', |
33060
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 listnames=lambda r: names.keys(), |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 namemap=namemap, nodemap=nodemap) |
46fa46608ca5
namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 repo.names.addnamespace(ns) |