Rev 3514: initial work on an lca algorithm for handling paths, 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 22:14:47 BST 2008


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

------------------------------------------------------------
revno: 3514
revision-id: john at arbash-meinel.com-20080624211445-g1nafs9fgg443p59
parent: john at arbash-meinel.com-20080624200945-qwlitl30s5c7fpnm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge3_per_file
timestamp: Tue 2008-06-24 16:14:45 -0500
message:
  initial work on an lca algorithm for handling paths,
  it still has issues on some paths I would have hoped weren't contentious.
modified:
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-06-24 20:09:45 +0000
+++ b/bzrlib/merge.py	2008-06-24 21:14:45 +0000
@@ -646,8 +646,13 @@
         other_values = {}
         all_changed = {}
 
-        affected_ids = set()
-
+        # 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
+        #      satisfied by a single iter_changes() call.) However, now we have
+        #      multiple iter_changes being called, and we need an overall
+        #      ordering.
+        file_id_ordering = []
         for base_revision_id, base_tree in self._lca_trees.iteritems():
             base_values = {}
             bases_values[base_revision_id] = base_values
@@ -665,13 +670,13 @@
                 if (self.interesting_ids is not None and
                     file_id not in self.interesting_ids):
                     continue
-
                 if changed:
                     all_changed[file_id] = True
 
                 if file_id not in other_values:
-                    other_values[file_id] = parents[0], names[0], executable[0]
-                base_values[file_id] = parents[1], names[1], executable[1]
+                    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]
         # We filled in everything we could as we went along, now we need to
         # make sure we have all the base and this information
 
@@ -700,7 +705,8 @@
         # Now we should have an entry in each base tree, and an entry for this
         # and other
         result = []
-        for file_id in all_file_ids:
+        assert not all_file_ids.symmetric_difference(file_id_ordering)
+        for file_id in file_id_ordering:
             base_tuples = [base[file_id] for base in bases_values.itervalues()]
             changed = all_changed.get(file_id, False)
             this_tuple = this_values[file_id]



More information about the bazaar-commits mailing list