[Extension] Dirty hack of 'shelve' and 'unshelve' command

Harri Salokorpi hsalokor at ee.oulu.fi
Sat May 28 20:40:19 BST 2005


On Saturday 28 May 2005 19:55, Aaron Bentley wrote:
> What I'm saying is that yes, we can support that, but the commandline is
> the ultimate merge tool, since it can invoke any other.

Absolutely. I'm not vouching against command line, I'm vouching for using 
external tools, be them graphical or command line.

> The goal of bzr isn't merely to be better than the competition, it's to
> be 'a joy to use'.

A part of joy of use for me is the ability to strictly control what happens 
and revert if I screw up.

> I'd like people to be able to go back and review 
> their merging choices, right up to the point where they commit.  I'd
> like them to be able to use several different tools, if they liked.

No argument here. About reviewing changes: if unshelving is restricted to 
unmodified working copy only, bzr diff gives the merged changes and 
(hypothetical) bzr revert allows going back to square zero. This is useful 
for recovering from screwup or trying again. Supporting revert and diff for 
changed working copy is a bit trickier.

> So I'd like shelve to provide an environment that makes commandline
> merging relatively easy.  I think that would mean keeping the snapshot
> around in some more concrete form.  Obviously, keeping a whole copy of
> the working tree is a lot of work and space, but I don't know which
> tools would accept a partial tree.

I think you can get away by just storing the changed files to shelve. The 
trick is to take an 'union' of the changed files, i.e. make a list of changed 
file in both shelve and working copy and union the lists. If a file that has 
changed in working copy and no matching counterpart is found in shelve, 
shelve copy of the file is copied from (shelves) base revision. If file is 
missing from working copy then there are two possibilities: either create 
empty file to keep the merge tool happy or just omit the file (I think most 
merge tools support copying missing file over, so I'd prefer the latter).

This way you get partial directory trees that both have same set of files. 
After this, you can throw the control to external tool and just pick up the 
result.

In fairyland, at least ;) I'm not sure what this would mean for the unshelve 
all -case where you have to do a merge. Or renames.

> So this 'ultimate unshelve' is still baking, I think.

Indeed.

-Harri




More information about the bazaar mailing list