switch (was Re: If bzrtools commands aren't experimental, merge them into bzr)
John Arbash Meinel
john at arbash-meinel.com
Thu Nov 15 14:55:46 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matthew D. Fuller wrote:
> On Thu, Nov 15, 2007 at 03:28:25PM +1000 I heard the voice of
> Ian Clatworthy, and lo! it spake thus:
>> Are there any objections to moving switch into the core? Any deep
>> thoughts on it's current design/limitations?
>
> Not qualified to make any code or architecture judgements, but from a
> UI perspective I'm in favor. With the proviso that it work with
> heavyweight checkouts too.
>
> In general, I think there are way too many behavioral differences
> between the two already. Ideally (IMAO), there should be none, short
> of specifically invoking different capabilities via commit --local or
> unbind or the like.
>
>
I really would like to have switch brought into core. I would really prefer if
it supported heavy checkouts. Also, I believe it fails if the current target
cannot be reached (which is one of the times when you would really want switch
to work). That is a bit more difficult, as the current logic is that we always
open the redirect when opening a BranchReference. We also sort of depend on
that for Launchpad branches, though James recently changed the lp:/// logic so
we don't need it there. (But people who 'bzr co http://launchpad.net/bzr' still
would).
I'm not sure what a nice api for getting just the local object would look like.
I guess we have
a_dir = BzrDir.open(url)
fmt = a_dir.find_branch_format()
Which will return BranchReferenceFormat.
And all BranchFormat objects have a "get_reference" member. So you can do:
reference = BzrDirMeta1.find_branch_format().get_reference()
if reference is not None:
# lightweight checkout
else:
b = a_dir.open_branch()
reference = b.get_bound_location()
if reference is not None:
# heavy checkout
What we need, though, is a BranchReferenceFormat.set_reference().
But those should be a couple small patches which would allow 'bzr switch' to be
useful in a bunch of difference scenarios.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHPF3yJdeBCYSNAAMRAgSQAJ4xpU+grRg0+R9uC1Ci1uksiIHTRACgsJLT
Ob+27NW6hlU87nD1wkcvKKc=
=KGMX
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list