sparse: refactor sparsechecksum()
This was relying on garbage collection to close the opened
file, which is a bug. Both callers simply called into self.vfs
to resolve the path. So refactor to use the vfs layer.
While we're here, rename the method to reflect it is internal
and to break anyone relying on the old behavior.
# Dummy extension to define a namespace containing revision names
from __future__ import absolute_import
from mercurial import (
namespaces,
)
def reposetup(ui, 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()]
ns = namespaces.namespace('revnames', templatename='revname',
logname='revname',
listnames=lambda r: names.keys(),
namemap=namemap, nodemap=nodemap)
repo.names.addnamespace(ns)