[RFC] branch --bind

Stephen J. Turnbull stephen at xemacs.org
Thu Jan 7 07:42:54 GMT 2010


Danny van Heumen writes:
 > John Arbash Meinel wrote:
 > > [snip]
 > > So *IMO* an optimal setup would be to get rid of heavyweight checkout as
 > > a concept. And stick with

I don't see this as an good answer to A Budden, who has a use case for
the *concept*.  It seems to me that it should be possible to
*automatically* implement the "heavyweight checkout = bound branch +
separate lightweight checkout" strategy.  This could be done by
convention (eg, reserve the .bzr-bound-branches subdirectory of the
shared repo for bound branches, what a surprise!) and then do the
equivalent of

heavyweight-checkout () {

    # tell user what's already there
    if test "$1"="--show"; then
        echo $MY_SHARED_REPO/.bzr-bound-branches
        ls $MY_SHARED_REPO/.bzr-bound-branches
        return
    fi

    # make a new heavyweight checkout
    # FIXME: think about allowing reuse of bound branches of the same
    # source
    source_branch=$1
    if test -n "$2"; then
        checkout_location=$2
    else
        checkout_location=`pwd`/`basename $source_branch`
    fi
    if test -n "$3"; then
        shared_repo=$3
    else
        shared_repo=$MY_SHARED_REPO
    bound_branch=.bzr-bound-branches/`basename $checkout_location`
    pushd $shared_repo
    bzr branch $source_branch $bound_branch
    cd $bound_branch
    bzr bind $source_branch
    popd
    bzr checkout --lightweight $bound_branch $checkout_location
}

(probably as a plugin or even use the above as a contrib shell
script).

Then you can reduce the *implementation* "primitive concepts" to

 > > Repository
 > > Branch
 > > Checkout

while still offering the heavyweight checkout concept to users.  I
don't know if this implementation would be acceptable to A Budden,
though.

Question: in the above classification, is "checkout" identical to
"version-controlled working tree" from the user's standpoint?
(Obviously for implementation the working tree is "everything but the
.bzr subtree".)

 > +1
 > 
 > I have more than once done a checkout, only to hit my head against the 
 > wall during the time all the history is being transferred :P.
 > For some reason I always expect a lightweight checkout (otherwise I 
 > would've just asked for a branch), only to find out during the process 
 > that it isn't.

Sure, but that's easy to fix by changing the default for "bzr
checkout".  (Technically easy, the cost of user transitions is of
course potentially large.)



More information about the bazaar mailing list