Rev 3504: Some small cleanups. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/merge3_per_file

John Arbash Meinel john at arbash-meinel.com
Fri Jun 20 21:07:54 BST 2008


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

------------------------------------------------------------
revno: 3504
revision-id: john at arbash-meinel.com-20080620200726-eusock9id21ey4a7
parent: pqm at pqm.ubuntu.com-20080618051428-txnglk8ls5jd93fc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge3_per_file
timestamp: Fri 2008-06-20 15:07:26 -0500
message:
  Some small cleanups.
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2008-05-29 20:17:37 +0000
+++ b/bzrlib/graph.py	2008-06-20 20:07:26 +0000
@@ -796,6 +796,8 @@
                     return result
             if len(lca) == 0:
                 raise errors.NoCommonAncestor(left_revision, right_revision)
+            trace.mutter('For revisions %s\nfound multiple lca: %s',
+                         sorted(revisions), sorted(lca))
             revisions = lca
 
     def iter_ancestry(self, revision_ids):

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2008-05-29 19:46:01 +0000
+++ b/bzrlib/merge.py	2008-06-20 20:07:26 +0000
@@ -22,6 +22,7 @@
 from bzrlib import (
     debug,
     errors,
+    graph as _mod_graph,
     osutils,
     patiencediff,
     registry,
@@ -92,6 +93,7 @@
         self._revision_graph = revision_graph
         self._base_is_ancestor = None
         self._base_is_other_ancestor = None
+        self._is_criss_cross = False
 
     @property
     def revision_graph(self):
@@ -357,6 +359,8 @@
             if steps > 1:
                 warning('Warning: criss-cross merge encountered.  See bzr'
                         ' help criss-cross.')
+                self._is_criss_cross = True
+                mutter('criss-cross base selected: %s', self.base_rev_id)
         self.base_tree = self.revision_tree(self.base_rev_id)
         self.base_is_ancestor = True
         self.base_is_other_ancestor = True
@@ -1255,6 +1259,7 @@
         self.vf = vf
         self._last_lines = None
         self._last_lines_revision_id = None
+        self._line_cache = {} # Map from revision_id => lines
         self._cached_matching_blocks = {}
 
     def plan_merge(self):
@@ -1372,9 +1377,9 @@
 
     def __init__(self, a_rev, b_rev, vf):
        _PlanMergeBase.__init__(self, a_rev, b_rev, vf)
-       a_ancestry = set(vf.get_ancestry(a_rev, topo_sorted=False))
-       b_ancestry = set(vf.get_ancestry(b_rev, topo_sorted=False))
-       self.uncommon = a_ancestry.symmetric_difference(b_ancestry)
+       graph = _mod_graph.Graph(vf)
+       a_ancestry, b_ancestry = graph.find_difference(a_rev, b_rev)
+       self.uncommon = a_ancestry.union(b_ancestry)
 
     def _determine_status(self, revision_id, unique_line_numbers):
         """Determines the status unique lines versus all lcas.

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2008-05-08 04:33:38 +0000
+++ b/bzrlib/tree.py	2008-06-20 20:07:26 +0000
@@ -383,6 +383,14 @@
         else:
             last_revision = file_revision(self)
             base_vf = self._get_weave(file_id)
+        # TODO: Is there a way we can determine that base_vf is already in
+        #       vf.fallback_versionedfiles? At the moment, because we got rid
+        #       of the transaction case, get_weave() returns a new object for
+        #       every call. So even though the source is the same, we end up
+        #       with several objects.
+        #       Which has bad consequences when we request a revision that
+        #       doesn't exist, because it has to query all of the fallback
+        #       files, and they don't share their cache.
         vf.fallback_versionedfiles.append(base_vf)
         return last_revision
 

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2008-05-29 14:40:07 +0000
+++ b/bzrlib/versionedfile.py	2008-06-20 20:07:26 +0000
@@ -630,10 +630,9 @@
             Graph,
             _StackedParentsProvider,
             )
-        from bzrlib.repofmt.knitrepo import _KnitParentsProvider
-        parent_providers = [DictParentsProvider(self._parents)]
-        for vf in self.fallback_versionedfiles:
-            parent_providers.append(_KnitParentsProvider(vf))
+        parent_providers = list(self.fallback_versionedfiles)
+        # Add this last, as it is the least likely to hit
+        parent_providers.append(DictParentsProvider(self._parents))
         return Graph(_StackedParentsProvider(parent_providers))
 
 



More information about the bazaar-commits mailing list