Rev 6472: (jelmer) Use inventories directly in fewer places. (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Wed Feb 22 13:39:52 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6472 [merge]
revision-id: pqm at pqm.ubuntu.com-20120222133951-cqvnnx710wox7905
parent: pqm at pqm.ubuntu.com-20120220173811-etlk9z98g8q83nq9
parent: jelmer at samba.org-20120220141525-9azkfei62st8yc7w
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2012-02-22 13:39:51 +0000
message:
  (jelmer) Use inventories directly in fewer places. (Jelmer Vernooij)
modified:
  bzrlib/bundle/serializer/v08.py v06.py-20051119041339-ee43f97270b01823
  bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
  bzrlib/tests/per_interrepository/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
=== modified file 'bzrlib/bundle/serializer/v08.py'
--- a/bzrlib/bundle/serializer/v08.py	2012-01-24 16:19:04 +0000
+++ b/bzrlib/bundle/serializer/v08.py	2012-02-20 14:15:25 +0000
@@ -287,13 +287,15 @@
 
         def finish_action(action, file_id, kind, meta_modified, text_modified,
                           old_path, new_path):
-            entry = new_tree.root_inventory[file_id]
-            if entry.revision != default_revision_id:
-                action.add_utf8_property('last-changed', entry.revision)
+            revision = new_tree.get_file_revision(file_id)
+            if revision != default_revision_id:
+                action.add_utf8_property('last-changed', revision)
             if meta_modified:
-                action.add_bool_property('executable', entry.executable)
+                action.add_bool_property('executable',
+                    new_tree.is_executable(file_id))
             if text_modified and kind == "symlink":
-                action.add_property('target', entry.symlink_target)
+                action.add_property('target',
+                    new_tree.get_symlink_target(file_id))
             if text_modified and kind == "file":
                 do_diff(file_id, old_path, new_path, action, force_binary)
             else:

=== modified file 'bzrlib/revisiontree.py'
--- a/bzrlib/revisiontree.py	2012-01-24 16:19:04 +0000
+++ b/bzrlib/revisiontree.py	2012-02-20 14:15:25 +0000
@@ -242,6 +242,19 @@
         annotations = annotator.annotate_flat(text_key)
         return [(key[-1], line) for key, line in annotations]
 
+    def __eq__(self, other):
+        if self is other:
+            return True
+        if isinstance(other, InventoryRevisionTree):
+            return (self.root_inventory == other.root_inventory)
+        return False
+
+    def __ne__(self, other):
+        return not (self == other)
+
+    def __hash__(self):
+        raise ValueError('not hashable')
+
 
 class InterCHKRevisionTree(tree.InterTree):
     """Fast path optimiser for RevisionTrees with CHK inventories."""

=== modified file 'bzrlib/tests/per_interrepository/test_fetch.py'
--- a/bzrlib/tests/per_interrepository/test_fetch.py	2012-01-24 16:19:04 +0000
+++ b/bzrlib/tests/per_interrepository/test_fetch.py	2012-02-20 14:15:25 +0000
@@ -383,10 +383,8 @@
         (stacked_left_tree,
          stacked_right_tree) = new_stacked_branch.repository.revision_trees(
             ['left', 'right'])
-        self.assertEqual(left_tree.root_inventory,
-                stacked_left_tree.root_inventory)
-        self.assertEqual(right_tree.root_inventory,
-                stacked_right_tree.root_inventory)
+        self.assertEqual(left_tree, stacked_left_tree)
+        self.assertEqual(right_tree, stacked_right_tree)
         # Finally, it's not enough to see that the basis inventories are
         # present.  The texts introduced in merge (and only those) should be
         # present, and also generating a stream should succeed without blowing




More information about the bazaar-commits mailing list