Checkout existing branch to established workspace (.moved)

Aaron Bentley aaron at
Thu Mar 29 18:40:09 UTC 2012

Hash: SHA1

On 12-03-29 01:51 PM, Colin D Bennett wrote:
> On Thu, 29 Mar 2012 13:26:54 -0400 Aaron Bentley
> <aaron at> wrote:
>> On 12-03-29 12:05 PM, Colin D Bennett wrote:
>>> Does the shelf live in the branch, or in the working tree as it
>>>  does today?
>> It lives in the branch.
> That's exciting, but also concerning.
> That's good in a lot of ways, especially since I generally
> consider a checkout to be “throwaway” and not “precious”.  By that
> I mean, if a checkout is clean, you can delete the checkout without
> losing any information.

Also, bzr zap --store will store uncommitted changes on the per-branch
shelf and then delete your checkout.

> But does that complicate things? What if you push or pull a branch
> with shelves?

Currently, per-branch shelves don't propagate through push and pull.
They are oriented toward the local workflow.  They exist in order to
preserve your uncommitted changes while your checkout is switched to a
different branch.  If your changes were ready for publication, you
would have committed them, right?  That said, they can be accessed

> Are the shelves themselves versioned?


> What if a shelf has been deleted from the source of a push, but not
> from the destination... will it be as messed up as the Bazaar tags
> implementation, such that deletes don't propagate with push/pull?

No, because they are never pushed/pulled.

> What if you have checked out a public shared branch, e.g., 'trunk' 
> of the project server... what happens if you shelve changes there?

The next person who switch-pipes into them gets the uncommitted
changes, and when they switch-pipe out, they are restored.

> One way that I often use shelves is if I start on some small piece 
> of work that might be a one-liner, I start out right in a checkout 
> of trunk without creating a feature branch as I generally do.  So, 
> in this checkout of trunk, I start making the change to the
> working tree, and realize I've had to make significant changes to
> stuff, so I want to switch to a new feature branch for the work. I
> will do a 'shelve', then 'switch --create-branch FEATURE' and then
> 'unshelve'.

What is the benefit over simply 'switch --create-branch FEATURE'?

> Will that work if shelves are stored in the branch instead of
> working tree?

I don't think the per-branch shelves can replace normal shelf
activities.  There is only one per branch, and they are managed
automatically by the switch-pipe command.  Calling them 'shelves' can
be misleading, since it implies you might "shelve", interactively edit
changes, and then explicitly "unshelve" later.  In Pipeline
documentation, I refer to them as "stored changes", instead.

There was a point when I thought pipelines could replace shelves, but
I no longer think so.  I find I want them to be distinct.

So the basic answer is "no".  There are some similar things you could
do, but they wouldn't have quite the same effect.

> What if someone else shelves a change to trunk from their checkout
> in between my shelve and unshelve operations?

switch-pipe refuses to operate when there are already shelved changes.

> Will I get the right change unshelved?

No, switch-pipe will abort.

> Does the above situation change if I instead have an unbound local 
> branch of trunk that I push/pull instead of using a checkout?

Yes.  In that case, the other user's changes are completely irrelevant
to you.

>> You can see which whether a branch has shelved changes, but not 
>> what the changes are.
> Do you mean that you can see a list of the shelves, with the 
> description, as 'bzr shelve --list' does?  Or do you mean a simple 
> “yes, there are one or more shelved changes” vs “no shelved 
> changes”?

I mean that there space for one set of shelved changes, and you can
see whether that space has been used or not.

>> We could probably add an option to diff to show a shelved
>> change, similar to -c
> I recently started using qbzr's qshelve/qunshelve tools, and *wow* 
> it makes shelves much more powerful since it's really tedious and 
> inefficient to do selective shelving, or explore the list of 
> changes on the shelf, with the command line.
> I hope the q(un)shelve tool will support any new shelving method.

Per-branch shelves are not normally used with interactive shelving.
Using q(un)shelve with them would be at odds with their purpose.

Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the bazaar mailing list