[PATCH] Enabling writable http transports (allows plugins to extend bzr)

John Arbash Meinel john at arbash-meinel.com
Tue Aug 22 19:53:36 BST 2006


Vincent LADEUIL wrote:
>>>>>> "jam" == John Arbash Meinel <john at arbash-meinel.com> writes:
> 
>     jam> Vincent LADEUIL wrote: ...
> 
>     jam> Now, it is possible that is_readonly() should cache the
>     jam> status, making the assumption that the readonly status
>     jam> won't change during the lifetime of a Transport object.
>     >>
>     jam> I'd like to get Robert's thoughts on this.
>     >>  Ok.
>     >> 
>     >> Updated version attached.
>     >> 
>     >> Vincent
> 
>     jam> If we sort out the 'is_readonly()' stuff, it has my
>     jam> +1. We'll wait to hear from Robert to see if it is
>     jam> considered trivial enough for 0.10.  It modifies an API,
>     jam> but in a completely backwards compatible way, with
>     jam> nothing being deprecated. And it is only used in the
>     jam> test suite anyway.  So I think it could go in. But I'm
>     jam> getting used to the concept. (Needs another +1 anyway).
> 
> Great.
> 
> In  the same  spirit  I think,  I  needed to  lightly modify  the
> test_rmdir (see? is_readonly  is used there too :)  to be able to
> make my plugin pass the 'bzr selftest'.
> 
> The attached patch complement and replace the preceding one.
> 
>     Vincent
> 

...

> 
> === modified file bzrlib/tests/test_transport_implementations.py
> --- bzrlib/tests/test_transport_implementations.py
> +++ bzrlib/tests/test_transport_implementations.py
> @@ -543,9 +543,9 @@
>          t.mkdir('adir')
>          t.mkdir('adir/bdir')
>          t.rmdir('adir/bdir')
> -        self.assertRaises(NoSuchFile, t.stat, 'adir/bdir')
> +        self.failIf(t.has('adir/bdir'))
>          t.rmdir('adir')
> -        self.assertRaises(NoSuchFile, t.stat, 'adir')
> +        self.failIf(t.has('adir'))
>  
>      def test_rmdir_not_empty(self):
>          """Deleting a non-empty directory raises an exception


Since 'stat' is tested elsewhere, this seems fine. Though technically,
you could implement 'stat' the same way that FTP does. All we really use
(right now) from stat is the size of the files. So you could make a size
request (in the worst case this would be a plain GET and read the number
of bytes returned), and then return a custom object that reports the size.

I'm pretty sure there is a special HEAD style request that you could
use, though.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060822/c85c4797/attachment.pgp 


More information about the bazaar mailing list