D3852: namespaces: let namespaces override singlenode() definition
Yuya Nishihara
yuya at tcha.org
Thu Jun 28 08:59:36 EDT 2018
Makes sense. One nit.
> + if not singlenode:
> + def singlenode(repo, name):
> + n = self.namemap(repo, name)
> + if n:
> + # return max revision number
> + if len(n) > 1:
> + cl = repo.changelog
> + maxrev = max(cl.rev(node) for node in n)
> + return cl.node(maxrev)
> + return n[0]
> + return None
> + self.singlenode = singlenode
The default implementation has to be defined as an unbound method to avoid
reference cycle: self.singlenode -> singlenode -> self.
More information about the Mercurial-devel
mailing list