[MERGE] Enable writable http transports

John Arbash Meinel john at arbash-meinel.com
Thu Aug 31 15:38:43 BST 2006


Vincent LADEUIL wrote:
>>>>>> "Aaron" == Aaron Bentley <aaron.bentley at utoronto.ca> writes:
> 
>     Aaron> Vincent LADEUIL wrote:
>     >> (TransportTests.test_rmdir): Use 'has' to test the existence of
>     >> the file instead of stat.  A transport may be writable without
>     >> implementing stat.  The intent of the test is to test rmdir not
>     >> stat.
> 
>     Aaron> Transport.has itself can be quite flaky on http.
>     Aaron> Perhaps calling rmdir a second time, and asserting
>     Aaron> that it raises NoSuchFile?
> 
> I don't understand what you mean by flaky, 'has' can't pretend a
> deleted directory still exists, does it ?

Well, there are a few ways that it can. But I think more importantly it
can say that an existing directory is missing.

(Some websites redirect invalid requests to another page, and thereby
don't give you back a 404. Others have directory listings turned off, so
you get some sort of invalid request when you ask for a directory.
Also, just think about the basic "If i go to http://foo.com/ it is
typically returning http://foo.com/index.html".)

Anyway, 'has()' should be avoided.

> 
>     >> @@ -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'))
> 
>     Aaron> We use the assert family, so assertFalse would be preferable here.
> 
> Sorry, both were used in the file, I guess I copy/paste the
> nearest :) 
> 
> Note that there are some more uses of failIf and looking at
> tests.__init__.py, I guess they may be deprecated.

I personally prefer failIf() and failUnless() to assertFalse and
assertTrue. Because I think they flow better:

failIf(x in y)
is a better 'sentence' than
assertFalse(x in y)

For everything else, I use assert*. So it is assertEqual() (because the
alternative is failUnlessEqual(), which IMO is too long).

Now, Aaron may be able to convince me to stop using failIf/failUnless.
But right now, I use them.


...

>     Aaron> Could you please not name your branch
>     Aaron> bzr.webdav/trunk?  The last element of the name should
>     Aaron> be unique to your project, because that's the default
>     Aaron> name used in various places.  Ideally, the last
>     Aaron> element would be the plugin name, i.e. "bzr/webdav" as
>     Aaron> in "bzrlib.plugins.webdav".  "trunk/bzr.webdav" or
>     Aaron> "bzr.webdav.trunk" would also be fine.

I'm not so sure about that anymore Aaron. I realize it would be nice if
you could do:

bzr get http://bazaar.launchpad.net/.../foobar
And have it create 'foobar' in your local directory.

But reading through Launchpad, it actually expects you to be using named
branches. Like 'trunk' and 'release-0.8' sort of thing. I think
ultimately we just need to get used to stuff like:

bzr get path/to/project/branch project

If you look here:
https://launchpad.net/products/bzr/+branches

And even if you ignore my abranches, a whole lot of them do not start
with 'bzr'. In fact, in Launchpad, the official mainline mirror is:
https://launchpad.net/people/bzr/+branch/bzr/trunk


> 
> Do you know how to rename a branch from the launchpad web site ?
> Or do I have to create a new branch ? In that case how do I
> delete the old one ?

There is a general policy of not deleting stuff from Launchpad. I think
it is because they are fairly open about letting people have access, and
they don't want a random person to be deleting important stuff.

So you have to go through an admin. I'm not sure if you can use an sftp
client to rename stuff, though.

...


> === modified file bzrlib/branch.py // last-changed:v.ladeuil at alplog.fr-20060828
> ... 100320-195cc799942db415
> --- bzrlib/branch.py
> +++ bzrlib/branch.py
> @@ -1248,7 +1248,7 @@
>                          "use bzrlib.urlutils.escape")
>                      
>              url = urlutils.relative_url(self.base, url)
> -            self.control_files.put('parent', url + '\n')
> +            self.control_files.put('parent', StringIO(url + '\n'))
>  
>      @deprecated_function(zero_nine)
>      def tree_config(self):

^- I have a branch to clean this up. I should probably finish refining
it and submit it again. Also, we'll be deprecating put() in place of
put_file() and put_bytes(), so you'll want to keep that in mind for your
webdav plugin.

Other than the tab, the rest of the code looks fine. With Aaron's +1,
I'll go ahead and merge it.

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/20060831/a6be8f1f/attachment.pgp 


More information about the bazaar mailing list