[MERGE] really get push working with less lock churn

Andrew Bennetts andrew.bennetts at canonical.com
Wed Apr 15 08:05:26 BST 2009


Robert Collins wrote:
> === modified file 'bzrlib/branch.py'
[...]
> +            # XXX: Lock correctness - should unlock our old repo if we were
> +            # locked.

Is this XXX likely to be a problem in the near future?

>      def lock_read(self):
> -        self.repository.lock_read()
> +        repo_control = getattr(self.repository, 'control_files', None)
> +        if self.control_files == repo_control or not self.is_locked():

I don't really understand what the first half of that if condition is for (and
I'm in a slight hurry to catch a train...).

> === modified file 'bzrlib/tests/lock_helpers.py'
> --- bzrlib/tests/lock_helpers.py	2009-03-23 14:59:43 +0000
> +++ bzrlib/tests/lock_helpers.py	2009-04-15 05:39:38 +0000
> @@ -44,6 +44,12 @@
>          self.__dict__['_allow_read'] = True
>          self.__dict__['_allow_unlock'] = True
>  
> +    def __eq__(self, other):
> +        # Branch objects look for controlfiles == repo.controlfiles.
> +        if type(other) == LockWrapper:

Use “is” to compare types.

-Andrew.




More information about the bazaar mailing list