[MERGE] BranchBuilder updates

John Arbash Meinel john at arbash-meinel.com
Tue Jul 22 21:24:57 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
| John Arbash Meinel wrote:
|> The one thing it doesn't support is "merge" because our merge code
|> depends on having a real disk backing the WorkingTree.
|
| I don't think that's accurate.  Merge works fine with a PreviewTransform
| as the target, and I'm working on PreviewTree to make it acceptable as a
| source.  PreviewTree/PreviewTransform do hit disk, but this an
| implementation detail that can easily be changed.
|
|> It also doesn't
|> support "rename" yet, because MemoryTree doesn't.
|
| PreviewTree does support rename.  Perhaps it would make sense to use it?
|
| Aaron

If we get to that point.

At the moment I don't have a problem simulating merges manually. Though
some tedium would be removed if I could use a "build_merge" and have it
do the work of merging the contents for me.

However, for what I'm doing right now, I need find-grained control over
the contents after a merge anyway.

So, if/when we get to the point of needing to actually do a merge behind
the scenes, we can look into using PreviewTree for that.

Mostly this is just an attempt to make a better api for building history
than:

tree = self.make_branch_and_tree(...)
self.build_tree_contents(...)
tree.add()
tree.commit()
self.build_tree_contents(...)
tree.add()/rename/remove
tree.commit()
other_tree = tree.bzrdir.sprout('other').open_workingtree()
....
other_tree.commit()
tree.merge_from_branch(other_tree.branch)
tree.commit()

And turning that into:

builder.build_snapshot(...)
builder.build_snapshot(...)
builder.build_snapshot(...)
builder.build_snapshot(...)

For what I've done so far, it is both easier to follow what is going on,
a lot less to type, and runs fully in memory so I don't waste time
hitting disk.

The only downside is that BranchBuilder is designed to re-open the
branch lock for every commit, rather than holding it open for multiple
commits in a row. I think it would be easy enough to restore that
ability, though.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiGQhkACgkQJdeBCYSNAAMGwwCeNLR43wDVLJKIDrBLgyj9+QMU
B6EAn3VmwX6SfVndTVqZ+zmAXbMQMVxN
=jSoC
-----END PGP SIGNATURE-----



More information about the bazaar mailing list