sapling/tests/revnamesext.py
Saurabh Singh 1030d2b7e5 namespaces: remove redundant name specification in namespace object
Summary:
This is unnecessary after the recent modifications in the namespace
code.

Reviewed By: quark-zju

Differential Revision: D9815973

fbshipit-source-id: d7c6b07226be35ebbbe5354d5c520c9807cc0aa6
2018-09-13 13:59:38 -07:00

24 lines
632 B
Python

# Dummy extension to define a namespace containing revision names
from __future__ import absolute_import
from mercurial import namespaces, registrar
namespacepredicate = registrar.namespacepredicate()
@namespacepredicate("revnames", priority=70)
def _revnamelookup(repo):
names = {"r%d" % rev: repo[rev].node() for rev in repo}
namemap = lambda r, name: names.get(name)
nodemap = lambda r, node: ["r%d" % repo[node].rev()]
return namespaces.namespace(
templatename="revname",
logname="revname",
listnames=lambda r: names.keys(),
namemap=namemap,
nodemap=nodemap,
)