[bug] Branch.open_containing refuses to open URLs

Martin Pool mbp at sourcefrog.net
Thu Jan 12 00:41:25 GMT 2006


On 12 Jan 2006, Robert Collins <robertc at robertcollins.net> wrote:
> On Wed, 2006-01-11 at 16:02 +1100, 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.
> 
> Is this WorkingTree.open_containing or Branch.open_containing ?
> WorkingTree should be like that, Branch should not.

My mistake, this is WorkingTree.open_containing.

So diff's intended user interface is a bit hard to reconcile with the
way Branches and Working Trees are disentangled.  We should perhaps
clear it up so that if the (implied) -r argument asks to diff against a
working tree it will do that; otherwise it just opens branches.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060112/8946ec5f/attachment.pgp 


More information about the bazaar mailing list