tests/revnamesext.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 01 Dec 2022 01:57:14 +0100
changeset 49820 0df2cff04291
parent 48966 6000f5b25c9b
permissions -rw-r--r--
path: pass `path` to `peer` in `hg bundle` We directly use the `path` object to build the `peer` object.

# Dummy extension to define a namespace containing revision names


from mercurial import namespaces


def reposetup(ui, repo):
    names = {b'r%d' % rev: repo[rev].node() for rev in repo}
    namemap = lambda r, name: names.get(name)
    nodemap = lambda r, node: [b'r%d' % repo[node].rev()]

    ns = namespaces.namespace(
        b'revnames',
        templatename=b'revname',
        logname=b'revname',
        listnames=lambda r: names.keys(),
        namemap=namemap,
        nodemap=nodemap,
    )
    repo.names.addnamespace(ns)