Rev 3515: Finally, bzr merge doesn't conflict on paths for 5.1=>ndb. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/merge3_per_file

John Arbash Meinel john at arbash-meinel.com
Tue Jun 24 23:36:08 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/merge3_per_file

------------------------------------------------------------
revno: 3515
revision-id: john at arbash-meinel.com-20080624223602-tsf3z7jj3h88k2d8
parent: john at arbash-meinel.com-20080624211445-g1nafs9fgg443p59
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge3_per_file
timestamp: Tue 2008-06-24 17:36:02 -0500
message:
  Finally, bzr merge doesn't conflict on paths for 5.1=>ndb.
  
  Basically, the path is missing in some LCAs, has one name in a base,
  which matches OTHER, but doesn't match THIS.
modified:
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-06-24 21:14:45 +0000
+++ b/bzrlib/merge.py	2008-06-24 22:36:02 +0000
@@ -463,6 +463,10 @@
         return len(merge.cooked_conflicts)
 
 
+# A singleton we can use for comparisons
+_not_present_in_tree = object()
+
+
 class Merge3Merger(object):
     """Three-way merger that uses the merge3 text merger"""
     requires_base = True
@@ -646,6 +650,8 @@
         other_values = {}
         all_changed = {}
 
+        not_present = (_not_present_in_tree, _not_present_in_tree,
+                       _not_present_in_tree)
         # XXX: It seems we have to go in an appropriate ordering. We probably
         #      just have to iterate all parents before their children, but I'm
         #      not clear what the specific requirement is (it seems to be
@@ -676,7 +682,10 @@
                 if file_id not in other_values:
                     file_id_ordering.append(file_id)
                     other_values[file_id] = parents[1], names[1], executable[1]
-                base_values[file_id] = parents[0], names[0], executable[0]
+                if (parents[0], names[0], executable[0]) == (None, None, None):
+                    base_values[file_id] = not_present
+                else:
+                    base_values[file_id] = parents[0], names[0], executable[0]
         # We filled in everything we could as we went along, now we need to
         # make sure we have all the base and this information
 
@@ -685,7 +694,8 @@
                 entry = the_inventory[file_id]
                 return (entry.parent_id, entry.name, entry.executable)
             else:
-                return (None, None, None)
+                return (_not_present_in_tree, _not_present_in_tree,
+                        _not_present_in_tree)
 
         this_values = {}
         this_inventory = self.this_tree.inventory
@@ -822,7 +832,7 @@
         """
         base_first = bases[0]
         for base in bases[1:]:
-            if base_first != base:
+            if base is not _not_present_in_tree and base_first != base:
                 break
         else: # All the bases are identical, we can just use 3-way
             return Merge3Merger._three_way(base_first, other, this)



More information about the bazaar-commits mailing list