Rev 1876: Fix corner case corruption pulling from a svn repository that contains bzr-roundtripped revisions. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Tue Sep 9 01:51:03 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1876
revision-id: jelmer at samba.org-20080909005059-zqdk8ofgddnnvj5w
parent: jelmer at samba.org-20080909003301-tiec1jn6ohm7st1o
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2008-09-09 02:50:59 +0200
message:
  Fix corner case corruption pulling from a svn repository that contains bzr-roundtripped revisions.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
=== modified file 'NEWS'
--- a/NEWS	2008-09-09 00:33:01 +0000
+++ b/NEWS	2008-09-09 00:50:59 +0000
@@ -45,6 +45,9 @@
    * Avoid leaking memory when attempting to open an invalid Subversion 
      repository. (#262513)
 
+   * Fix corner case corruption pulling from a svn repository that contains bzr-roundtripped 
+     revisions. (#260416)
+
   INTERNALS
 
    * Remove custom commit code for working tree. 

=== modified file 'commit.py'
--- a/commit.py	2008-09-08 22:16:22 +0000
+++ b/commit.py	2008-09-09 00:50:59 +0000
@@ -154,6 +154,7 @@
         self.push_metadata = push_metadata
         self._append_revisions_only = append_revisions_only
         self._text_parents = {}
+        self._texts = texts
 
         # Gather information about revision on top of which the commit is 
         # happening
@@ -624,10 +625,19 @@
                 accessed when the entry has a revision of None - that is when 
                 it is a candidate to commit.
         """
-        self._text_parents[ie.file_id] = []
-        for parent_inv in parent_invs:
-            if ie.file_id in parent_inv:
-                self._text_parents[ie.file_id].append(parent_inv[ie.file_id].revision)
+        if self._texts is None or ie.revision is None:
+            self._text_parents[ie.file_id] = []
+            for parent_inv in parent_invs:
+                if ie.file_id in parent_inv:
+                    self._text_parents[ie.file_id].append(parent_inv[ie.file_id].revision)
+        else:
+            key = (ie.file_id, ie.revision)
+            parent_map = self._texts.get_parent_map([key])
+            if ie.parent_id is None and (not key in parent_map or parent_map[key] is None):
+                # non-rich-root repositories don't have a text for the root
+                self._text_parents[ie.file_id] = self.parents
+            else:
+                self._text_parents[ie.file_id] = [r[1] for r in parent_map[key]]
         self.new_inventory.add(ie)
         assert (ie.file_id not in self.old_inv or 
                 self.old_inv[ie.file_id].revision is not None)




More information about the bazaar-commits mailing list