D3852: namespaces: let namespaces override singlenode() definition
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jun 28 14:25:07 UTC 2018
martinvonz added a comment.
In https://phab.mercurial-scm.org/D3852#60160, @yuja wrote:
> 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.
Done
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3852
To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list