Rev 3536: add more filtering for when a directory hasn't actually changed. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi

John Arbash Meinel john at arbash-meinel.com
Tue Jul 22 23:11:26 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/merge_lca_multi

------------------------------------------------------------
revno: 3536
revision-id: john at arbash-meinel.com-20080722221021-j1b5fln4430q827r
parent: john at arbash-meinel.com-20080722215639-vtsdwysizs2m28k6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_lca_multi
timestamp: Tue 2008-07-22 17:10:21 -0500
message:
  add more filtering for when a directory hasn't actually changed.
  
  This simplifies the tests because it filters out all the root-id noise.
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-07-22 21:56:39 +0000
+++ b/bzrlib/merge.py	2008-07-22 22:10:21 +0000
@@ -671,6 +671,26 @@
                     break
             else: # Identical in all trees
                 continue
+            other_kind = other_ie.kind
+            other_parent_id = other_ie.parent_id
+            other_name = other_ie.name
+            kind_changed = False
+            parent_id_changed = False
+            name_changed = False
+            for lca_path, ie in lca_values:
+                if ie.kind != other_kind:
+                    kind_changed = True
+                if ie.parent_id != other_parent_id:
+                    parent_id_changed = True
+                if ie.name != other_name:
+                    name_changed = True
+
+            if (not kind_changed and not parent_id_changed
+                and not name_changed and other_kind == 'directory'):
+                # Even though last-modified has changed, the actual attributes
+                # of this entry hasn't changed, so skip it.
+                continue
+
             if file_id in base_inventory:
                 base_ie = self.base_tree.inventory[file_id]
                 base_parent_id = base_ie.parent_id

=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2008-07-22 21:56:39 +0000
+++ b/bzrlib/tests/test_merge.py	2008-07-22 22:10:21 +0000
@@ -1234,11 +1234,7 @@
         # (file_id, changed, parents, names, executable)
         # BASE, lca1, lca2, OTHER, THIS
         root_id = 'a-root-id'
-        self.assertEqual([(root_id, True,
-                           ((None, [None, None]), None, None),
-                           ((u'', [u'', u'']), u'', u''),
-                           ((False, [False, False]), False, False)),
-                          ('a-id', True,
+        self.assertEqual([('a-id', True,
                            ((root_id, [root_id, root_id]), root_id, root_id),
                            ((u'a', [u'a', u'a']), u'a', u'a'),
                            ((False, [False, False]), False, False)),
@@ -1275,10 +1271,6 @@
         self.assertEqual(['D-id', 'E-id'], sorted(merge_obj._lca_trees.keys()))
         self.assertEqual('A-id', merge_obj.base_tree.get_revision_id())
         entries = list(merge_obj._entries_lca())
-        # Ignore the root entry, as it looks like it is always modified when it
-        # really isn't
-        root = entries.pop(0)
-        self.assertEqual('a-root-id', root[0])
         root_id = 'a-root-id'
         self.assertEqual([('bar-id', True,
                            ((None, [root_id, root_id]), root_id, root_id),
@@ -1305,10 +1297,6 @@
         self.assertEqual('A-id', merge_obj.base_tree.get_revision_id())
 
         entries = list(merge_obj._entries_lca())
-        # Ignore the root entry, as it looks like it is always modified when it
-        # really isn't
-        root = entries.pop(0)
-        self.assertEqual('a-root-id', root[0])
         root_id = 'a-root-id'
         self.assertEqual([('a-id', True,
                            ((root_id, [root_id, root_id]), root_id, None),
@@ -1320,8 +1308,6 @@
     #       simple criss-cross LCAS identical, BASE different
     #       x-x changed from BASE but identical for all LCAs and tips
     #               should be possible with the same trick of 'not-in-base'
-    #       x-x file not in BASE
-    #       x-x file not in THIS
     #       x-x OTHER deletes the file
     #       x-x OTHER introduces the file
     #       x-x LCAs differ, one in ancestry of other for a given file



More information about the bazaar-commits mailing list