Mercurial > hg
view tests/revnamesext.py @ 37615:f3dc8239e3a9
peer: scatter module to the wind (API)
peer.py hardly contained any code. The code it did contain was
generic to the version 1 peer interface or specific to the
local repository peer.
So code has been moved to wireprotov1peer and localrepo, as
appropriate.
Differential Revision: https://phab.mercurial-scm.org/D3260
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 11 Apr 2018 12:51:09 -0700 |
parents | 086fc71fbb09 |
children | 2372284d9457 |
line wrap: on
line source
# Dummy extension to define a namespace containing revision names from __future__ import absolute_import 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)