Introducing Shelf 2
John Arbash Meinel
john at arbash-meinel.com
Fri Oct 10 21:34:32 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Aaron Bentley wrote:
>> This sounds pretty cool. I'd like to see it merged in, because it's
>> something many users may want, and because that'll make it easier for
>> GUIs to build on it.
I would also like to see it merged in.
> I'm happy with that. Shelf 2 has a dependency on /usr/bin/patch. This
> is because shelf 2 requires inexact patching (it edits diff hunks
> without updating their positions). Bazaar supports only exact patching.
> Should we:
> - make bzr depend on patch?
> - implement inexact patch ourselves?
> - teach shelf to update the hunk positions so we can do exact patching?
> - change the UI to not use unified diffs?
Is there any chance we could save snapshots rather than diffs and then
we can use the regular 3-way merge logic to re-apply them?
The idea would be:
1) Compute the diff from the current text to whatever base text
(--revision if given, otherwise wt.base_tree()).
2) Capture the (file_id, revision_id) key that represents the base text.
3) Allow the user to edit the diff hunks as they see fit.
4) Apply that new diff to the base text, and store that.
Alternatively, we can still store the diff as long as we store the base
text it applies to. Then when we go to apply it, we just extract the
base text, and apply the diff, and then we have a 3-way merge.
One of my big complaints with 'bzr shelf' right now, is that if the
patch won't apply cleanly it would refuse to 'unshelve'. I've run into
that by shelving and making a change to the same line. I'd rather end up
with a conflict than not be able to unshelf.
I'd rather not make bzr depend on patch if we can help it. Especially
considering we have a much better algorithm for doing merging of changes
than inexact patching.
It sounds like we would still need to teach shelf to update the hunk
positions, and then also store extra information.
It may be more work than you think is worthwhile, though I think the
end-result would be nicer.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar