tests/revnamesext.py
author Boris Feld <boris.feld@octobus.net>
Fri, 16 Nov 2018 14:21:47 +0100
changeset 40651 1243295fcc3a
parent 36548 086fc71fbb09
child 43076 2372284d9457
permissions -rw-r--r--
logtoprocess: update commandfinish options arguments d2c997b8001f changed the logtoprocess API with the effect of not exposing the positional arguments to the logtoprocess scripts anymore. We have some scripts that use the duration and return code of the "commandfinish" event to monitor hg calls. Update the logging of the "commandfinish" to expose those values as options argument, which will be accessible as `OPT_RETURN_CODE` and `OPT_DURATION` in logtoprocess arguments. The code has been formatted with Black. Differential Revision: https://phab.mercurial-scm.org/D5282
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33048
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):
36548
086fc71fbb09 py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents: 33048
diff changeset
    10
    names = {b'r%d' % rev: repo[rev].node() for rev in repo}
33048
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)
36548
086fc71fbb09 py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents: 33048
diff changeset
    12
    nodemap = lambda r, node: [b'r%d' % repo[node].rev()]
33048
46fa46608ca5 namespaces: record and expose whether namespace is built-in
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
36548
086fc71fbb09 py3: mark all string literals in test-command-template.t as bytes
Yuya Nishihara <yuya@tcha.org>
parents: 33048
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: 33048
diff changeset
    15
                              logname=b'revname',
33048
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)