Introducing Shelf 2
Aaron Bentley
aaron at aaronbentley.com
Thu Oct 9 05:29:06 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
Most Bazaar users seem to love the 'shelf' command. I think it's
fantastically useful, and that's not vanity because the primary author
was Michael Ellerman.
Nice as it is, shelf has limitations because it's based on applying
patches. It can't shelve renames. It can shelve added files, but won't
restore their file ids when you unshelve. Basically, it's not as close
to revert as it ought to be, which leaves users having to decide whether
they need shelf or revert.
May I introduce Sheve 2?
It's based on iter_changes, merge, PreviewTree and packs.
When you shelve your changes, it creates a TransformPreview that would
revert your changes if applied to your last-committed revision. It then
serializes this to a pack-based format.
When you unshelve, it deserializes your changes, produces a PreviewTree,
and merges that into your working tree.
Because merge is used, not patch, text conflicts are handled using bzr's
standard mechanism, not using patch's .rej and .orig files.
This new implementation has three layers:
Layer 1: TreeTransform serialization
Layer 2: Shelving implementation classes
Layer 3: Console shelving UI.
I am hoping to merge 1 and 2 into bzr proper. Maybe 3 as well,
depending on what people think. But with this new design, it should be
quite easy to implement GUIs for shelving. Patch is only used in layer
3 -- you could conceivably use anything to edit the text; gvimdiff and
meld come to mind.
Shelf 2 is by no means complete. But it is already better than shelf in
some respects (rename, better add, better remove, better conflict
handling), and usable enough for me to start using. If you'd like to
try it, you'll need:
http://code.aaronbentley.com/bzr/shelf2/shelf-ui
A Bazaar patched with
http://bundlebuggy.aaronbentley.com/download_patch/%3C48ED767A.7000904@aaronbentley.com%3E
BzrTools revno 666 (or later)
Future work will likely include
- - making the serialized format more compact
- - making _get_one_revision_tree and _ChangeReporter into public symbols
- - shelving single files
- - shelving kind changes
- - unshelving changes from a specified position in the stack.
Shelf supports multiple named shelves, but I don't think they're
commonly used. I may not implement them for Shelf 2, and just have a
single stack.
Enjoy!
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI7YiR0F+nu1YWqI0RAp10AJ9KPbuPiY3u0U5hXcgQ1D2kSsElLACfc7+W
ptztWwQco5mi1ehwD2Qqmys=
=d1G5
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list