Merge lp:~abentley/bzr/commit-preview into lp:~bzr/bzr/trunk-old

Proposed by Aaron Bentley
Status: Merged
Merged at revision: not available
Proposed branch: lp:~abentley/bzr/commit-preview
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 41 lines
To merge this branch: bzr merge lp:~abentley/bzr/commit-preview
Reviewer Review Type Date Requested Status
Bazaar Developers Pending
Review via email: mp+6716@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

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

Hi all,

This patch enables committing a TreeTransform and its PreviewTree to a
branch. This allows synthetic trees to be committed to disk. It could
be useful with looms and for committing to new branches. The current
client is Launchpad Translations.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoUPMEACgkQ0F+nu1YWqI0c4wCfRowxvpZOFBbHBe2xF/1QZGHM
a5AAn3YvgboQD/78oaR5ZqpbwcOp5iXG
=PRxG
-----END PGP SIGNATURE-----

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/test_transform.py'
--- bzrlib/tests/test_transform.py 2009-05-06 05:36:28 +0000
+++ bzrlib/tests/test_transform.py 2009-05-20 17:35:10 +0000
@@ -2604,6 +2604,23 @@
2604 'tree/foo'))2604 'tree/foo'))
2605 self.assertEqual(False, preview_tree.is_executable('baz-id'))2605 self.assertEqual(False, preview_tree.is_executable('baz-id'))
26062606
2607 def test_commit_preview_tree(self):
2608 tree = self.make_branch_and_tree('tree')
2609 rev_id = tree.commit('rev1')
2610 tree.branch.lock_write()
2611 self.addCleanup(tree.branch.unlock)
2612 tt = TransformPreview(tree)
2613 tt.new_file('file', tt.root, 'contents', 'file_id')
2614 self.addCleanup(tt.finalize)
2615 preview = tt.get_preview_tree()
2616 preview.set_parent_ids([rev_id])
2617 builder = tree.branch.get_commit_builder([rev_id])
2618 list(builder.record_iter_changes(preview, rev_id, tt.iter_changes()))
2619 builder.finish_inventory()
2620 rev2_id = builder.commit('rev2')
2621 rev2_tree = tree.branch.repository.revision_tree(rev2_id)
2622 self.assertEqual('contents', rev2_tree.get_file_text('file_id'))
2623
26072624
2608class FakeSerializer(object):2625class FakeSerializer(object):
2609 """Serializer implementation that simply returns the input.2626 """Serializer implementation that simply returns the input.
26102627
=== modified file 'bzrlib/transform.py'
--- bzrlib/transform.py 2009-05-06 05:36:28 +0000
+++ bzrlib/transform.py 2009-05-20 17:35:10 +0000
@@ -1880,6 +1880,9 @@
1880 name = self._transform._limbo_name(trans_id)1880 name = self._transform._limbo_name(trans_id)
1881 return open(name, 'rb')1881 return open(name, 'rb')
18821882
1883 def get_file_with_stat(self, file_id, path):
1884 return self.get_file(file_id, path), None
1885
1883 def annotate_iter(self, file_id,1886 def annotate_iter(self, file_id,
1884 default_revision=_mod_revision.CURRENT_REVISION):1887 default_revision=_mod_revision.CURRENT_REVISION):
1885 changes = self._changes(file_id)1888 changes = self._changes(file_id)