Rev 29: Add a check that all files in an inventory have correct last-modified revisions. in http://bazaar.launchpad.net/%7Ejameinel/bzr-hg/demandload_import_fixes

John Arbash Meinel john at arbash-meinel.com
Tue Jul 31 23:46:34 BST 2007


At http://bazaar.launchpad.net/%7Ejameinel/bzr-hg/demandload_import_fixes

------------------------------------------------------------
revno: 29
revision-id: john at arbash-meinel.com-20070731224554-32rwtage3u4088ju
parent: john at arbash-meinel.com-20070731194027-f94qqahm1tuel3mp
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hg
timestamp: Tue 2007-07-31 17:45:54 -0500
message:
  Add a check that all files in an inventory have correct last-modified revisions.
  This catches a couple bug earlier.
  I don't know *why* we have invalid data (yet).
  But I can guarantee that the inventory converter claims a last modified value
  which is incorrect.
modified:
  __init__.py                    __init__.py-20060531211707-2fy7rwqqcmfgf8ve-1
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-07-31 19:40:27 +0000
+++ b/__init__.py	2007-07-31 22:45:54 +0000
@@ -754,6 +754,7 @@
                                 # if its not in the cache, its in target already
                                 inventories[parent] = self.target.get_inventory(parent)
                                 previous_inventories.append(inventories[parent])
+                        # import pdb; pdb.set_trace()
                         file_heads = entry.find_previous_heads(
                             previous_inventories,
                             target_repo.weave_store,
@@ -778,6 +779,16 @@
                             lines = split_lines(text)
                             weave.add_lines(revision_id, file_heads, 
                                             split_lines(text))
+                    else:
+                        if entry.revision is not None:
+                            weave = target_repo.weave_store.get_weave_or_empty(
+                                        fileid, target_transaction)
+                            if entry.revision not in weave:
+                                raise AssertionError('Inventory reports that'
+                                    ' file id %s was last modified in %s'
+                                    ' but the weave for that file does'
+                                    ' not contain that revision'
+                                    % (fileid, entry.revision))
                 self.target.add_inventory(revision_id, inventory, 
                                           revision.parent_ids)
                 self.target.add_revision(revision_id, revision)



More information about the bazaar-commits mailing list