[MERGE] Move responsibility for detecting same-repo fetching from the optimiser to the wrapper function.

Robert Collins robertc at robertcollins.net
Thu Oct 4 07:36:53 BST 2007


On Thu, 2007-10-04 at 01:48 -0400, Martin Pool wrote:


> === modified file 'bzrlib/remote.py'
> --- bzrlib/remote.py    2007-10-03 05:25:50 +0000
> +++ bzrlib/remote.py    2007-10-04 01:24:06 +0000
> @@ -607,6 +607,13 @@
>           return False
> 
>       def fetch(self, source, revision_id=None, pb=None):
> +        if self.has_same_location(source):
> +            # check that last_revision is in 'from' and then return a
> +            # no-operation.
> +            if (revision_id is not None and
> +                not _mod_revision.is_null(revision_id)):
> +                self.get_revision(revision_id)
> +            return 0, []
>           self._ensure_real()
> 
> 
> Why is this a no-op on remote repos but an error on local repositories?

Its not, its the same on both - self.get_revision() will error if
revision_id is absent.

> +            mutter_callsite(3, "has_revision is a LBYL symptom.")
> 
> I realize you're just updating this, but I think the message would be 
> more
> clear by telling the caller to "don't call has_revision, just try to 
> access it"
> or something similar.

This isn't so much for random users of the library, but for us, I don't
think we need to go to great detail as such.

I'll happily try to be a little less pithy in new messages or when
touching a message.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071004/63c82788/attachment.pgp 


More information about the bazaar mailing list