Rev 3509: Handle the case when the per-file graph shows an obvious dominator. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/merge3_per_file

John Arbash Meinel john at arbash-meinel.com
Sat Jun 21 02:21:38 BST 2008


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

------------------------------------------------------------
revno: 3509
revision-id: john at arbash-meinel.com-20080621012108-gd43ci897wohmgj1
parent: john at arbash-meinel.com-20080621004004-rycnow0cg7uaym63
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge3_per_file
timestamp: Fri 2008-06-20 20:21:08 -0500
message:
  Handle the case when the per-file graph shows an obvious dominator.
  We probably could shortcut in this case, but it isn't a big deal.
-------------- next part --------------
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-06-21 00:40:04 +0000
+++ b/bzrlib/merge.py	2008-06-21 01:21:08 +0000
@@ -1385,9 +1385,8 @@
     def _find_recursive_lcas(self):
         """Find all the ancestors back to a unique lca"""
         cur_ancestors = (self.a_rev, self.b_rev)
-        note('finding lcas for %s', cur_ancestors)
+        note('finding lcas for %s:\n%s', self.vf, cur_ancestors)
         graph = _mod_graph.Graph(self.vf)
-        import pdb; pdb.set_trace()
         ancestors = [cur_ancestors]
         while True:
             next_lcas = graph.find_lca(*cur_ancestors)
@@ -1425,6 +1424,12 @@
         last_parents = ()
         for ancestors in lcas:
             for ancestor in ancestors:
+                if self._weave.has_version(ancestor):
+                    # Most likely this happened because one node purely
+                    # dominated another in the per-file graph. That is okay, we
+                    # already have it in the weave, and the plan should be very
+                    # straightforward.
+                    continue
                 self._weave.add_lines(ancestor, last_parents,
                                       all_texts[ancestor])
             last_parents = ancestors

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2008-06-20 21:39:32 +0000
+++ b/bzrlib/versionedfile.py	2008-06-21 01:21:08 +0000
@@ -540,6 +540,9 @@
         self._parents = {}
         self._lines = {}
 
+    def __repr__(self):
+        return '%s(%s)' % (self.__class__.__name__, self._file_id)
+
     def plan_merge(self, ver_a, ver_b, base=None):
         """See VersionedFile.plan_merge"""
         from bzrlib.merge import _PlanMerge



More information about the bazaar-commits mailing list