[PATCH RFC] repo: differentiate between repos and proxies for potentially remotes

Adrian Buehlmann adrian at cadifra.com
Sat Jun 4 09:26:24 CDT 2011


On 2011-06-03 20:37, Peter Arrenbrecht wrote:
> # HG changeset patch
> # User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
> # Date 1307126195 -7200
> # Node ID 063cd4fae0ee0606678ed22dbaf1c77948301662
> # Parent  1ffeeb91c55d0b00445ceabde14a0d0faf906a33
> repo: differentiate between repos and proxies for potentially remotes

...

> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py

...

> @@ -159,6 +287,11 @@
>                  parts.pop()
>          return False
>  
> +    def proxy(self):
> +        if not hasattr(self, '_proxy'):
> +            self._proxy = localproxy(self)
> +        return self._proxy
> +

Hmm. So this function of localrepository creates a localproxy object
which holds a reference to the localrepository object, which in turn
holds a reference to the localproxy object.

Can't say I'm particularly thrilled by this, since it introduces a
reference cycle:

               ----------------------------
              |                            |
              |                            v
       localrepository object          localproxy object
              ^                            |
              |                            |
               ----------------------------

Is this really worth the GC troubles?


More information about the Mercurial-devel mailing list