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.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to