Rev 4374: (abentley) Enable committing from a PreviewTree. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 20 19:22:57 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4374
revision-id: pqm at pqm.ubuntu.com-20090520182253-iqt2y0uikaxswu56
parent: pqm at pqm.ubuntu.com-20090520014435-p13hzwf0jh3e8spe
parent: aaron at aaronbentley.com-20090520172014-c3met75t69n8ilo9
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-05-20 19:22:53 +0100
message:
  (abentley) Enable committing from a PreviewTree.
modified:
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 4354.4.4
    revision-id: aaron at aaronbentley.com-20090520172014-c3met75t69n8ilo9
    parent: aaron at aaronbentley.com-20090520104150-d5s3mrl4uyc0udty
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: commit-preview
    timestamp: Wed 2009-05-20 19:20:14 +0200
    message:
      Simplify by using CommitBuilder directly
    modified:
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 4354.4.3
    revision-id: aaron at aaronbentley.com-20090520104150-d5s3mrl4uyc0udty
    parent: aaron at aaronbentley.com-20090520104050-f0o4bv6n3r8xm2ub
    parent: pqm at pqm.ubuntu.com-20090520014435-p13hzwf0jh3e8spe
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: commit-preview
    timestamp: Wed 2009-05-20 12:41:50 +0200
    message:
      Merge bzr.dev
    added:
      bzrlib/_rio_py.py              _rio_py.py-20090514104624-ied3d39oju8anmfz-1
      bzrlib/_rio_pyx.pyx            _rio_pyx.pyx-20090514104636-8203jcqvfny56yrd-1
      bzrlib/tests/test__rio.py      test__rio.py-20090514191748-cy74k8yj46gzoeq6-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics/en/eol.txt  eol.txt-20090327060429-todzdjmqt3bpv5r8-3
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/rio.py                  rio.py-20051128032247-770b120b34dfff60
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/blackbox/test_dpush.py test_dpush.py-20090108125928-st1td6le59g0vyv2-1
      bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
      bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/test_chk_map.py   test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
      bzrlib/tests/test_foreign.py   test_foreign.py-20081125004048-ywb901edgp9lluxo-1
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
      bzrlib/win32utils.py           win32console.py-20051021033308-123c6c929d04973d
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/xml_serializer.py       xml.py-20050309040759-57d51586fdec365d
      doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 4354.4.2
    revision-id: aaron at aaronbentley.com-20090520104050-f0o4bv6n3r8xm2ub
    parent: aaron at aaronbentley.com-20090519091407-u6gnpr6uj9e0rbju
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: commit-preview
    timestamp: Wed 2009-05-20 12:40:50 +0200
    message:
      Allow committing a file add to a PreviewTree.
    modified:
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 4354.4.1
    revision-id: aaron at aaronbentley.com-20090519091407-u6gnpr6uj9e0rbju
    parent: pqm at pqm.ubuntu.com-20090512090530-v9355ohetp61ltc1
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: commit-preview
    timestamp: Tue 2009-05-19 11:14:07 +0200
    message:
      Trivial support for committing PreviewTree.
    modified:
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2009-05-06 05:36:28 +0000
+++ b/bzrlib/tests/test_transform.py	2009-05-20 17:20:14 +0000
@@ -2604,6 +2604,23 @@
                                                            'tree/foo'))
         self.assertEqual(False, preview_tree.is_executable('baz-id'))
 
+    def test_commit_preview_tree(self):
+        tree = self.make_branch_and_tree('tree')
+        rev_id = tree.commit('rev1')
+        tree.branch.lock_write()
+        self.addCleanup(tree.branch.unlock)
+        tt = TransformPreview(tree)
+        tt.new_file('file', tt.root, 'contents', 'file_id')
+        self.addCleanup(tt.finalize)
+        preview = tt.get_preview_tree()
+        preview.set_parent_ids([rev_id])
+        builder = tree.branch.get_commit_builder([rev_id])
+        list(builder.record_iter_changes(preview, rev_id, tt.iter_changes()))
+        builder.finish_inventory()
+        rev2_id = builder.commit('rev2')
+        rev2_tree = tree.branch.repository.revision_tree(rev2_id)
+        self.assertEqual('contents', rev2_tree.get_file_text('file_id'))
+
 
 class FakeSerializer(object):
     """Serializer implementation that simply returns the input.

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2009-05-06 05:36:28 +0000
+++ b/bzrlib/transform.py	2009-05-20 17:20:14 +0000
@@ -1880,6 +1880,9 @@
         name = self._transform._limbo_name(trans_id)
         return open(name, 'rb')
 
+    def get_file_with_stat(self, file_id, path):
+        return self.get_file(file_id, path), None
+
     def annotate_iter(self, file_id,
                       default_revision=_mod_revision.CURRENT_REVISION):
         changes = self._changes(file_id)




More information about the bazaar-commits mailing list