[bug] Branch.open_containing refuses to open URLs

John A Meinel john at arbash-meinel.com
Wed Jan 11 05:08:11 GMT 2006


Martin Pool wrote:
> Branch.open_containing has this code, apparently from Robert:
> 
>     @staticmethod
>     def open_containing(path=None):
>         """Open an existing working tree which has its root about path.
>         
>         This probes for a working tree at path and searches upwards from
> there.
> 
>         Basically we keep looking up until we find the control directory
> or
>         run into /.  If there isn't one, raises NotBranchError.
>         TODO: give this a new exception.
>         If there is one, it is returned, along with the unused portion
> of path.
>         """
>         if path is None:
>             path = getcwd()
>         else:
>             # sanity check.
>             if path.find('://') != -1:
>                 raise NotBranchError(path=path)
> 
> The exception means that you cannot, for example, run diff against a
> remote repository.
> 
>   bzr diff -r 1528..1529 http://repo.spacepants.org/bzr.jaq/
> 
> Can we instead have something like this:
> 
>   if it's a path, make it absolute
>   while true:
>     try to open the url as the root of a directory
>     otherwise, go up one step, unless already at the root directory 
>        or top-level url
> 

What was the specific problem with transport.clone('..'). I know there
was discussion that it should raise an exception, rather than return the
same path at /. It seems like then we can just tell let the transport
figure out what the path should become.
(I'm fine with making it a different command, like transport.parent_dir()).

John
=:->


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


More information about the bazaar mailing list