[PATCH 2 of 3 RFC] obsolete: allow passing a revision to successorssets()

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 15 18:50:35 CDT 2013


On 8 août 2013, at 09:48, Dan Villiom Podlaski Christiansen wrote:

> # HG changeset patch
> # User Dan Villiom Podlaski Christiansen  <danchr at gmail.com>
> # Date 1375616619 -7200
> #      Sun Aug 04 13:43:39 2013 +0200
> # Node ID b1f7ae28c3e371a70ee363a4fbe5d50063a224fc
> # Parent  02c24ad6f4d2d954da11d128280978e25aaa48fd
> obsolete: allow passing a revision to successorssets()

Why do you need this.

> 
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -496,6 +496,9 @@ def successorssets(repo, initialnode, ca
>     for its live spawn. Code that makes multiple calls to `successorssets`
>     *must* use this cache mechanism or suffer terrible performances."""
> 
> +    if isinstance(initialnode, int):
> +        initialnode = repo.unfiltered().changelog.node(initialnode)
> +

No! this function is not aware that revision exist and have no reason to be aware of them.

The current signature is:

	successorssets(repo, initialnode, cache=None)

it could be:

	successorssets(obsstore, knownnodes, initialnode, cache=None)

We pass the repo object because it happen to have the two informations handy. But We all hope to diet the localrepo class.

-- 
Pierre-Yves


More information about the Mercurial-devel mailing list