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

Sune Foldager cryo at cyanite.org
Sat Jun 4 10:17:13 CDT 2011


On 2011-06-04 16:26, Adrian Buehlmann wrote:
>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?

Maybe we don't need to cache the proxy, since it's really light-weight. That
would eliminate the cycle.


More information about the Mercurial-devel mailing list